Convert MySQL date to UNIX timestamp
Here is a simple function to convert MySQL date format to UNIX timestamp
<?php
//UPDATE: There is more simple way to get same result
//
$mysqltime = '20101109140000';
$timestamp = strtotime($mysqltime);
echo date("Y-m-d H:i:s", $timestamp);
// 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;
}
?>
We recommend
internet monitoring softwareSEO
SEO consultancy
Recommended Hosting Fatcow Host Reviews
Bacheca Web
Recommended
- Consider Big John Design for your more difficult coding requirements. Accessibility is a given. Fast bug-busting a speciality.CSS Guru.
- DHTMLgoodies
- coder24.com
- WeberDev.com



