Hi,
: its very likely I'm missing something, but what that something is
: alludes me. I'm trying to convert epoch seconds to a usable date
: format, but I'm having no luck at all. I don't want to use localtime
: () because it gives a huge string that I really can't use. What I'm
: after is a date formated like this: yyyy-mm-dd
Note that you can use localtime in array context to get all the bits of the date:-
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year is an offset since 1900, so you need to do:
$year += 1900;
: Below is the code I'm working with and the resulting output.
:
:
: 1 #!/usr/bin/perl
: 2 #
: 3
: 4 use strict;
: 5 use Time::CTime;
: 6
: 7 my $epochSeconds = time;
: 8
: 9 my $theDate= strftime( '%Y-%M-%d', $epochSeconds );
: 10
: 11 print "The Epoch Seconds are\: $epochSeconds\n";
: 12 print "The Converted Date is\: $theDate\n";
:
:
: The output:
:
: The Epoch Seconds are: 1069474375
: The Converted Date is: 1900-00-00
I think you're using it wrongly; see:-
http://search.cpan.org/~muir/Time-modules-2003.0211/lib/Time/CTime.pm
From glancing at the docs, I think what you want to be putting is:-
my $theDate= strftime( '%Y-%m-%d', localtime($epochSeconds));
Note %M = minutes, %m is month.
Jonathan
###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");