Gossamer Forum
Home : General : Perl Programming :

Date conversion

Quote Reply
Date conversion
How can I convert a date (MMDDYYYY) in the same format as given by the time function - that is seconds since 01/01/1970. The reason is that I need to compare 2 dates and determine if the second date occurs before or after the first date. It seems easier if there is a Unix built-in function that will do this (which I seem to recall there is).

Dan Smile
Quote Reply
Re: Date conversion In reply to
PHP could do that, I think... *wink*

I think the easiest way to do that would be to use a regexp and split apart the date, then reorder it YYYYMMDD, do the same for the other date, then do a simple greater/less/equal comparison.

------------------
Charles Capps
http://solareclipse.net/
Quote Reply
Re: Date conversion In reply to
Bobsie wrote a conversion script once, just search the Links Mod. forum!
Quote Reply
Re: Date conversion In reply to
Thanks! The solution was to convert the date string to YYYYMMDD. So simple, I'm still kicking myself. Thanks again!

Dan Smile