The following code snippet:
echo date("d.m.Y-H:i:s", strtotime("01.01.2000-11:12:32"));
returns me:
01.01.1970-01:00:00
What's the right way to convert "01.01.2000-11:12:32" to time/date object, for comparing it with the current timestamp?
e.g.
if (date("d.m.Y-H:i:s") > date("d.m.Y-H:i:s", strtotime("01.01.2000-11:12:32"))) {
echo "future";
} else {
echo "past";
}
This is due to localisation. Try giving a different format, as the format matters a lot:
.
for date and month separator.-
.If you are getting the input from another source, try using
str_replace
:Output: http://ideone.com/d19ATK