delickate Posted August 11, 2008 Share Posted August 11, 2008 Hi guys, I'm changing date format. like this $date = '10/07/2008'; echo $date = date('M j, Y', $date); its output like this : Oct 7,2008 it wokrs perfect. but when i fetch date from databse base. its out put is like Jan 1, 1970 i stored the date in date base like : 10/07/2008 write the code like: $date = $GB_DATE; //$GB_DATE is the field name of database table and its value is :10/07/2008 echo $date = date('M j, Y', $date); but its out put is like: Jan 1, 1970 any body know why is happening? any body have solution plz Link to comment https://forums.phpfreaks.com/topic/119100-help-plzdate-format/ Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 Have a look at strtotime(). echo $date = date('M j, Y', strtotime($date)); Link to comment https://forums.phpfreaks.com/topic/119100-help-plzdate-format/#findComment-613253 Share on other sites More sharing options...
delickate Posted August 11, 2008 Author Share Posted August 11, 2008 i've use this as well but same result Link to comment https://forums.phpfreaks.com/topic/119100-help-plzdate-format/#findComment-613254 Share on other sites More sharing options...
JasonLewis Posted August 11, 2008 Share Posted August 11, 2008 Okay, so $DB_DATE is being set by something like: $DB_DATE = $data['date']; Make sure that the variable has the date in it. Echo it out somewhere. Link to comment https://forums.phpfreaks.com/topic/119100-help-plzdate-format/#findComment-613271 Share on other sites More sharing options...
delickate Posted August 11, 2008 Author Share Posted August 11, 2008 yeah value is correct. i echo it. is there any solutions Link to comment https://forums.phpfreaks.com/topic/119100-help-plzdate-format/#findComment-613273 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.