bachx Posted July 10, 2007 Share Posted July 10, 2007 I have a date format of YYYY/MM/DD for some dates stored in my database. I want to create a php script that reads this format and converts it to the Unix format. Any help? Thanks. Link to comment https://forums.phpfreaks.com/topic/59241-unixdate-formats-conversion/ Share on other sites More sharing options...
Wildbug Posted July 10, 2007 Share Posted July 10, 2007 http://us.php.net/manual/en/function.strtotime.php Or, if your database is MySQL, create a new column and populate it with the following: UPDATE table SET new_ts_col = UNIX_TIMESTAMP(STR_TO_DATE(datecolumn,'%Y/%m/%d')); http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date Link to comment https://forums.phpfreaks.com/topic/59241-unixdate-formats-conversion/#findComment-294277 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.