Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Date to epoch

by Utilitarian (Vicar)
on Jul 19, 2012 at 07:38 UTC ( #982598=note: print w/replies, xml ) Need Help??

in reply to Date to epoch

the mktime function in the POSIX module is your friend here.
~/$ perl -MPOSIX -E 'say POSIX::mktime(15, 28, 06, 27, 02, 206);' 4299114495 ~/$ perl -E 'say scalar localtime (4299114495);' Sat Mar 27 06:28:15 2106
The important thing to note is that the year value is $year - 1900 (but of course you are going to read the POSIX pod now anyway in order to see how strftime works to create ISO date strings ;) )

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://982598]
[ambrus]: Like <c>{ package AnyEvent::Impl:: Prima; use Prima; sub io{ my($s,%r)=@_; Prima::File->new( file=>$r{fh},mask =>("w"eq$r{poll}? fe::Write():fe:: Read())|fe:: Exception,onRead =>$r{cb},onWrite =>$r{cb}, onException=>$r{cb }) } sub timer { ... } push @AnyEvent::REGI
[ambrus]: argh, too long, let me try on scratchpad
[Corion]: . o O ( I seem to have improved my skills of getting other people to write code for me )
[ambrus]: ambrus's scratchpad

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2016-12-08 12:41 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (141 votes). Check out past polls.