MySQL date to PHP timestamp


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function mysql2php($str) {
  2. list($date, $time) = explode(' ', $str);
  3. list($year, $month, $day) = explode('-', $date);
  4. list($hour, $minute, $second) = explode(':', $time);
  5.  
  6. $timestamp = mktime($hour, $minute, $second, $month, $day, $year);
  7.  
  8. return $timestamp;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.