...

View Full Version : datetime problem?



stfc_boy
11-28-2007, 01:51 PM
Hi Guys,

I have a datetime column in mysql saved in the following format:

2007-05-22 09:03:17

How could I echo this information in a normal written date and time. I thought it would be something like:



<?php $newdate = strftime("%W %e %M %Y, %H:%i:%s", strtotime($row['published_web_date_time'])); ?>


But that does not seem to work?

Thanks

Iszak
11-28-2007, 02:26 PM
I think your problem is because you're not using the US style of time, you see they generally have it mm/dd/yyyy where as you have it yyyy-mm-dd that is my guess.

aWishResigned
11-28-2007, 03:08 PM
For re-arranging information like that, I would recommend you look up explode (http://www.php.net/manual/en/function.explode.php). It's a handy function that will help you do what you need to do.

CFMaBiSmAd
11-28-2007, 03:25 PM
Here is the quickest and most efficient way of formatting a mysql DATETIME column in any format you want - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum