techiefreak05 Posted November 19, 2008 Share Posted November 19, 2008 I know I can take the value of time() and convert it to a date format... but how can I do the reverse.? Thanks. Link to comment https://forums.phpfreaks.com/topic/133366-solved-convert-30-11-2008-to-unix-timestamp/ Share on other sites More sharing options...
genericnumber1 Posted November 19, 2008 Share Posted November 19, 2008 strtotime() but you might want to be careful about the ambiguity of dates like 12-12-2008 (which one is the month?). Link to comment https://forums.phpfreaks.com/topic/133366-solved-convert-30-11-2008-to-unix-timestamp/#findComment-693637 Share on other sites More sharing options...
techiefreak05 Posted November 19, 2008 Author Share Posted November 19, 2008 It's like: DAY-MONTH-YEAR. What format would you suggest? Link to comment https://forums.phpfreaks.com/topic/133366-solved-convert-30-11-2008-to-unix-timestamp/#findComment-693640 Share on other sites More sharing options...
genericnumber1 Posted November 19, 2008 Share Posted November 19, 2008 In this case it might be less ambiguous to just use mktime() <?php $date = '30-11-2008'; list($day, $month, $year) = explode('-', $date); $timestamp = mktime(null, null, null, $month, $day, $year); ?> Link to comment https://forums.phpfreaks.com/topic/133366-solved-convert-30-11-2008-to-unix-timestamp/#findComment-693649 Share on other sites More sharing options...
techiefreak05 Posted November 19, 2008 Author Share Posted November 19, 2008 Thanks a lot! Link to comment https://forums.phpfreaks.com/topic/133366-solved-convert-30-11-2008-to-unix-timestamp/#findComment-693650 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.