>"Ng Hwee Hwee" <[EMAIL PROTECTED]> wrote in message
>Hi all,
>can someone kindly point me to a resource that converts all kinds of
possible date inputs into MySQL format of YYYY-MM-DD?
>example of formats to be converted includes:
>yy       - 2 digit representation of year
>yyyy   - ful numeric representation of year
>m       - numeric representation of month, without leading zero
>mm    - numeric representation of month, with leading zero
>mmm - short textual representation of month
>d       - day of month without leading zero
>dd     - day of month with leadin zero

This question belongs more to the general list, but anyway:

You can use strtotime() to convert various formats to a timestamp. Then use
date() to convert it back to your preferred date format:

$timestamp = strtotime($inputDate);
$isoDate   = date('Y-m-d', $timestamp);


Regards, Torsten Roehr

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to