Reputation: 31
I made a script where I put all date informations: day, month, year , hour , minutes and format like AM or PM. Then I take all informations with:
$day = $_POST['day']
..........
That's how I take all informations and it works well, but when I wanna do:
$time = strtotime($hour.':'.$minute.' '.$format.' '.$year.'-'.$month.'-'.$day);
It updates my database with UTC from 1970, actualy first second ever count.
What is wrong?
Upvotes: 0
Views: 31
Reputation: 31
Yeah, strtotime works fine now with this format:
$time = strtotime($day.'-'.$month.'-'.$year.' '.$hour.':'.$minute.' '.$format);
That's the correct version !
Upvotes: 0
Reputation: 219914
The H:i A Y-m-d
is not an acceptable format for strtotime()
. You need to use Y-m-d H:i A
.
$time = strtotime($year.'-'.$month.'-'.$day.' '.$hour.':'.$minute.' '.$format);
Upvotes: 2