NAMEupdate: OOPS. Sorry I didn't look more closely at your code before posting. Anyway, I think there's nothing wrong with using Time::Local -- it does exactly what you want in this case.
Time::Local - efficiently compute time from local and GMT timeSYNOPSIS
$time = timelocal($sec,$min,$hour,$mday,$mon,$year);
$time = timegm($sec,$min,$hour,$mday,$mon,$year);DESCRIPTION
These routines are the inverse of built-in perl functions localtime() and gmtime()...
another update: One nice thing I learned about Time::Local -- you can give it scalar values that equate to things like "Feb 30 2001", and it does the "right" thing, in the sense of returning the time in terms of "two days after Feb 28 2001". This came in very handy when I had to do some date arithmetic -- e.g. determine month and day of month for "day before" or "day after" a given date, or some number of hours before or after a given time. (This was some years ago, before I learned about Date::Manip -- or maybe before that module even existed.)
In reply to Re: scalar localtime() to timestamp
by graff
in thread scalar localtime() to timestamp
by jonnyfolk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |