Return to Snippet

Revision: 32268
at September 21, 2010 22:06 by sveggiani


Initial Code
<?php
// from MySQL to UNIX timestamp
function convert_datetime($str) 
{

list($date, $time) = explode(' ', $str);
list($year, $month, $day) = explode('-', $date);
list($hour, $minute, $second) = explode(':', $time);

$timestamp = mktime($hour, $minute, $second, $month, $day, $year);

return $timestamp;
}
?>

Initial URL
http://www.vision.to/convert-mysql-date-to-unix-timestamp.php

Initial Description

                                

Initial Title
Convert MySQL date to UNIX timestamp

Initial Tags

                                

Initial Language
PHP