[thelist] [PHP] reformat date...

Brooking, John John.Brooking at sappi.com
Thu Jan 25 12:21:16 CST 2007

> Note: To generate a timestamp from a string representation of the
> date, you may be able to use strtotime(). Additionally, some databases
> have functions to convert their date formats into timestamps (such as
> MySQL's UNIX_TIMESTAMP function).

Yes. strtotime is extremely useful. It can even do date arithmetic for
strings like "next Monday". For your purposes, look at:

Based on that last page especially, this might work, although I have not
tested it:

   $input = '3/MAY/07';
   $dbfmt = date( 'Y-m-d', strtotime( str_replace( '/', '-' , $input

- John


This message may contain information which is private, privileged or confidential and is intended solely for the use of the individual or entity named in the message. If you are not the intended recipient of this message, please notify the sender thereof and destroy / delete the message. Neither the sender nor Sappi Limited (including its subsidiaries and associated companies) shall incur any liability resulting directly or indirectly from accessing any of the attached files which may contain a virus or the like.

More information about the thelist mailing list