mubashir Posted October 26, 2007 Share Posted October 26, 2007 i hve a date variable in mm-dd-yyyy format how can i change it to mysql default format i.e., yyyy-mm-dd format ... Link to comment https://forums.phpfreaks.com/topic/74884-changing-date-format/ Share on other sites More sharing options...
jeppers Posted October 26, 2007 Share Posted October 26, 2007 Show me your code Link to comment https://forums.phpfreaks.com/topic/74884-changing-date-format/#findComment-378610 Share on other sites More sharing options...
premiso Posted October 26, 2007 Share Posted October 26, 2007 www.php.net/strtotime www.php.net/date <?php $date = "01-01-2007"; $tstamp = strtotime($date); $newdate = date("Y-m-d", $tstamp); echo $newdate; ?> Link to comment https://forums.phpfreaks.com/topic/74884-changing-date-format/#findComment-378613 Share on other sites More sharing options...
rajivgonsalves Posted October 26, 2007 Share Posted October 26, 2007 or use the mysql function STR_TO_DATE example STR_TO_DATE( '07/31/2007', '%m/%d/%Y' ) Link to comment https://forums.phpfreaks.com/topic/74884-changing-date-format/#findComment-378619 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.