Posted By

rifat on 06/04/10


Tagged

mysql php timestamp


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

rafi
dantreacy
beertigger


MySQL date to PHP timestamp


 / Published in: PHP
 

  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  

You need to login to post a comment.