Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: TIME::LOCAL from within KSH

by AltBlue (Chaplain)
on May 19, 2007 at 03:02 UTC ( [id://616296]=note: print w/replies, xml ) Need Help??


in reply to TIME::LOCAL from within KSH

An error message would have been useful here, but for starters let's guess you meant Time::Local (case sensitive) and -M (importing timelocal).
e.g.: perl -MTime::Local -le 'print timelocal(...)'

Better yet, rather than calling perl for such tiny operations maybe you should read date(1) man page (pay attention to -d parameter).

--
altblue.

Replies are listed 'Best First'.
Re^2: TIME::LOCAL from within KSH
by graff (Chancellor) on May 19, 2007 at 04:52 UTC
    What version of "date(1)" are you talking about? My version (MacOSX/darwin, based on bsd) doesn't have a "-d" option at all, and on a freebsd machine, "-d" means "set the kernel's value for daylight savings time". (Looks like the Solaris 5.8's "date" didn't have "-d" either, and on a linux box, "-d STRING" doesn't seem to report seconds since epoch, but  date +%s does.)

    Just curious...

      What version of "date(1)" are you talking about?

      Sorry, OP didn't mention anything about his/her env.

      "-d STRING" doesn't seem to report seconds since epoch, but date +%s does

      "-d STRING" will be used for passing custom time, otherwise you'll be formatting the current time ;-)

      e.g.:

      $ date -d '1987-12-18 12:13:14' -u '+%s' 566827994 $ date -d '1987-12-18' -u '+%s' 566784000

      --
      altblue.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2025-07-15 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.