Saturday, 15 September 2012

php - Why am I not getting the dates I have chosen? -


I have a form that allows the user to input two dates but date 1970-01-01 . Any help?

Date1:

  here & lt; Td> & Lt; Label = "date_1" & gt; Date as Date / MM / yyyy (date_1) & lt; / Labels & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input name = "date_1" type = "text" class = "big" id = "date_1" value = "" size = "12" />  

Here's my PHP:

  $ first = $ _REQUEST ["date_1"]; $ Sec = $ _REQUEST ["date_2"]; $ F_date = Date ('Y-M-D', stratoum ($ first)); $ S_date = Date ('Y-M-D', Straighttoem ($ sec)); If (isset ($ _ GET ["submit"])) {echo $ f_date; Echo & lt; Br / & gt; '; Echo $ s_date;  

use

  echo date time :: createFromFormat ('D / m / y', $ date) - & gt; Format ('ym-d');  

1 comment: