brmcdani44 Posted May 3, 2013 Share Posted May 3, 2013 I have a table that is being dynamically generated off of a SQL query. I am trying to convert a date to the American version of the date field (m,d,y), however there is an error in my code.Can someone help me out? Any help is appreciated! Thanks in advance! echo "<td>"date('d-m-Y', strtotime(.$row['submit_date'].));"</td>"; Link to comment https://forums.phpfreaks.com/topic/277591-beginner-date-conversion-question/ Share on other sites More sharing options...
davidannis Posted May 3, 2013 Share Posted May 3, 2013 Why do you have periods in strtotime(.$row['submit_date'].)? Link to comment https://forums.phpfreaks.com/topic/277591-beginner-date-conversion-question/#findComment-1427975 Share on other sites More sharing options...
davidannis Posted May 3, 2013 Share Posted May 3, 2013 Try echo "<td>".date('d-m-Y', strtotime($row['submit_date']))."</td>"; Note: The periods concatenate (combine) the peices of the string being echoed. Link to comment https://forums.phpfreaks.com/topic/277591-beginner-date-conversion-question/#findComment-1427976 Share on other sites More sharing options...
brmcdani44 Posted May 3, 2013 Author Share Posted May 3, 2013 Sorry I thought I had to have to periods since I was continuing from $row. Thanks for your help Link to comment https://forums.phpfreaks.com/topic/277591-beginner-date-conversion-question/#findComment-1427985 Share on other sites More sharing options...
Yohanne Posted May 3, 2013 Share Posted May 3, 2013 http://www.php.net/manual/en/datetime.format.php Link to comment https://forums.phpfreaks.com/topic/277591-beginner-date-conversion-question/#findComment-1427988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.