ohdang888 Posted July 4, 2010 Share Posted July 4, 2010 I have dates in this format: Wed, 26 May 2010 14:59:42 +0000 how can i get the mysql datetime or unix timestamp from this date? Thanks Link to comment https://forums.phpfreaks.com/topic/206713-convert-date-to-datetime-or-unixtimestamp/ Share on other sites More sharing options...
kenrbnsn Posted July 4, 2010 Share Posted July 4, 2010 Use the strtotime function and the date function <?php $str = 'Wed, 26 May 2010 14:59:42 +0000'; $timestamp = strtotime($str); echo $timestamp . '<br>'; $datetime = date('Y-m-d',$timestamp); echo $datetime . '</br>'; ?> Ken Link to comment https://forums.phpfreaks.com/topic/206713-convert-date-to-datetime-or-unixtimestamp/#findComment-1081065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.