patsfans Posted May 28, 2010 Share Posted May 28, 2010 I have the following code: <? $date = "2010-05-19 12:51:47"; echo date("F n, Y",strtotime($date)); ?> It's outputting May 5, 2010 instead of May 19, 2010. I'm guessing this is easy - so I'm just trying to figure out what I'm doing wrong....? Link to comment https://forums.phpfreaks.com/topic/203210-php-timecode-to-date-problem/ Share on other sites More sharing options...
PFMaBiSmAd Posted May 28, 2010 Share Posted May 28, 2010 n Numeric representation of a month, without leading zeros 1 through 12 Link to comment https://forums.phpfreaks.com/topic/203210-php-timecode-to-date-problem/#findComment-1064715 Share on other sites More sharing options...
patsfans Posted May 28, 2010 Author Share Posted May 28, 2010 I think I just figured it out: <? $date = "2010-05-19 12:51:47"; //echo date("F n, Y",strtotime($date)); $timestamp = strtotime($date); $formatted_date = date('F d, Y', $timestamp); echo "$formatted_date"; ?> It returned correctly - so hopefully someone else finds this useful. Link to comment https://forums.phpfreaks.com/topic/203210-php-timecode-to-date-problem/#findComment-1064716 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.