Personally, I use the following bit of code. All it does is take a 14 digit 
timestamp and convert it into a unix timestamp:

function date($date) {
   //Extract the parts from the date
   $year  = substr($date, 0,  4);
   $month = substr($date, 4,  2);
   $day   = substr($date, 6,  2);
   $hour  = substr($date, 8,  2);
   $min   = substr($date, 10, 2);
   $sec   = substr($date, 10, 2);
   //return the unix timestamp for the date passed
   return (gmmktime($hour, $min, $sec, $month, $day, $year));

 From then on, you can use the date function in PHP to manage the date. 
There are also ways to do it using the SQL command (DATE_FORMATE() I think 
is one), but you'll have to read the manual for into on that.

At 20:56 13/01/2002 +0100, Sander Peters wrote:
>Hello everybody,
>convert yyyy/mm/dd to mm/dd/yyyy, how?
>MYSQL does everything in yyyy/mm/dd.
>I live in the Netherlands and we are use to the format dd/mm/yyyy.
>What's the best way to display it as mm/dd/yyyy in a table on a query?
>My first idea whas to split the date up in vars in php and then print
>the vars in the way I like it
>Is this a bad idea? Or are there better sollutions?
>Thanx in advance for answering!
>Met vriendelijke groet / With Greetings,
>Sander Peters
>    site: http://www.visionnet.nl/
>   email: mailto:[EMAIL PROTECTED]
>webmail: mailto:[EMAIL PROTECTED]
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]

// Jonathan Wright
// GCS d- s: a-- C++(+) US> P+++ L+> E> W+++ !N w !O M- V- PS+@ PE+
//    Y PGP t+ !5 X R- tv(-) b(+) DI++++> D+(++) G h-- r-- z--(++)

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to