Convert "Jun 8 2003 12:00AM" to a timestamp which can then be used with the date() 
function to format the date to whatever format you want.

Lets say you've inserted the date as '6/8/03' and you want the data to remain the same 
when you retrieve it:

<?
$ts = strtotime("Jun 8 2003 12:00AM");
echo date("n/j/y", $ts);
?>

so all you have to do is replace "Jun 8 2003 12:00AM" with data retrieved from the DB

> -----Original Message-----
> From: Dale Hersh [mailto:[EMAIL PROTECTED]
> Sent: Friday, 22 August 2003 12:13
> To: [EMAIL PROTECTED]
> Subject: [PHP] datetime
> 
> 
> I am using a mssql database and I have a question regarding 
> the datetime
> type. When I write a date to the database it store the date 
> in the following
> format:
> 6/8/03
> 
> But when I extract the date from the database it returns the 
> value in the
> following format:
> Jun 8 2003 12:00AM
> 
> Is there a nice function available in php that will format 
> the date based
> upon certain specification. I know that date() exists, but I 
> that means I
> would have to use mktime() which would require parsing the 
> entire string and
> breaking the string into the day, the month, the year. 
> Furthermore, I would
> then need a switch statement to convert the value Jun into 
> the value 6.
> 
> I appreciate any help.
> 
> Thanks,
> Dale
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


*************************************************************************************
This e-mail, including any attachments to it, may contain confidential and/or personal 
information.
If you have received this e-mail in error, you must not copy, distribute, or disclose 
it, use or take any action 
based on the information contained within it.

Please notify the sender immediately by return e-mail of the error and then delete the 
original e-mail.

The information contained within this e-mail may be solely the opinion of the sender 
and may not necessarily 
reflect the position, beliefs or opinions of Salmat on any issue.

This email has been swept for the presence of computer viruses known to Salmat's 
anti-virus systems.

For more information, visit our website at  www.salmat.com.au.
*************************************************************************************


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

Reply via email to