Sie befinden sich hier: Typo3 / Extension-Programmierung / Convert MySQL date to UNIX timestamp
Deutsch
English
Sonntag, 24.06.2018

Convert MySQL date to UNIX timestamp

Convert MySQL date to UNIX timestamp
Here is a simple function to convert MySQL date format to UNIX timestamp

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

<?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;
}
?>