I've this on my reservation form $day_dol = ($_POST['day_dol']); $month_dol = ($_POST['month_dol']); $year_dol = ($_POST['year_dol']); $day = ($_POST['day']); $month = ($_POST['month']); $year = ($_POST['year']); $datum_dolaska= "$year_dol-$month_dol-$day_dol"; $datum_odlaska = "$year-$month-$day"; $dolazak = date("Y-m-d", strtotime($datum_dolaska)); $odlazak = date("Y-m-d", strtotime($datum_odlaska)); echo " $dolazak,$odlazak "; I put b.e $datum_dolaska= "2009-August-01" and $datum_odlaska = "2009-August-03". And I want by example put on my form reservation "2009-08-01" like day of arrival and "2009-08-03" like day of leaving. But I got it "1970-01-01" both dates. What is the problem? Thank you forward on helping me!
i think because post variables are not passing any values to $datum_dolaska and why u r using 2 variables in same name if u want to show different u need to change variable names.. here is what should u do: $datum_dolaska1= "$year_dol-$month_dol-$day_dol"; $datum_odlaska2 = "$year-$month-$day"; $dolazak1 = date("Y-m-d", strtotime($datum_dolaska1)); $odlazak2 = date("Y-m-d", strtotime($datum_odlaska2)); echo " $dolazak1,$odlazak2 ";
They were already different variable names they just look very similar echo out $datum_dolaska $datum_odlaska make sure they are yyyy-mm-dd or yy-mm-dd and then echo out echo strtotime($datum_dolaska); echo strtotime($datum_odlaska); and you can see where it is going wrong