Convert your date to time

<?php function mydate2time($str){ if (!preg_match("/(?P<day>\d{2})\/(?P<month>\d{2})\/(?P<year>\d{4})\s+(?P<hour>\d{2}):(?P<minute>\d{2})/", $str, $m)){ return 0; } return mktime($m['hour'], $m['minute'], 0, $m['month'], $m['day'], $m['year']); } $str = '30/10/2016 07:01'; $date = mydate2time($str); echo "<pre>"; echo "Input: $str<br/>"; echo "To int: $date<br/>"; echo "Test to time: ".date('Y-m-d H:i:s', $date); echo "</pre>"; //output /* Input: 30/10/2016 07:01 To int: 1477785660 Test to time: 2016-10-30 07:01:00 */

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.