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. Quote 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?). Quote 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? Quote 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); ?> Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.