Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: working with epoch seconds

by Hue-Bond (Priest)
on Oct 09, 2006 at 11:47 UTC ( [id://577143]=note: print w/replies, xml ) Need Help??


in reply to Re^2: working with epoch seconds
in thread working with epoch seconds

Use a module:

use strict; use warnings; use DateTime; my $dt = DateTime->now; print $dt->strftime ("%Y %m %d, %H:%M:%S %Z\n"); $dt->set_time_zone ('America/New_York'); print $dt->strftime ("%Y %m %d, %H:%M:%S %Z\n"); __END__ 2006 10 09, 11:45:55 UTC 2006 10 09, 07:45:55 EDT

Update: Ah, you figured it out. That's great :^).

--
David Serrano

Replies are listed 'Best First'.
Re^4: working with epoch seconds
by jeanluca (Deacon) on Oct 09, 2006 at 12:34 UTC
    it seems to work :), but what is the difference between POSIX 'strftime' and DateTime::strftime ?

    LuCa

      DateTime::strftime works on DateTime objects, while POSIX::strftime works on the parameters you supply each time you call it. Apart from that, there should be no difference between them:

      use DateTime; use POSIX qw/strftime/; print DateTime-> now-> set_time_zone ('Europe/Madrid')-> strftime ("%Y %m %d, %H:%M:%S %Z\n"); print strftime "%Y %m %d, %H:%M:%S %Z\n", localtime; __END__ 2006 10 09, 14:57:36 CEST 2006 10 09, 14:57:36 CEST

      --
      David Serrano

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://577143]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-25 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found