datetime - getting the proper date format in php -


i trying fetch start date , end date following date format

wed 19 - sat 22 june 2013 

now want output :-

startdate = 2013-06-19 enddate = 2013-06-22 

but getting output as:-

startdate = 1970-01-01 enddate = 2013-06-22 

what have tried:-

$old_date = explode('-',$date); $startdate = date("y-m-d",strtotime($old_date[0])); $enddate = date("y-m-d",strtotime($old_date[1])); 

can me out?

do this:

$date= "wed 19 - sat 22 june 2013"; $old_date = explode(' - ',$date); $xdate=explode(" ",$old_date[1]); $startdate = date("y-m-d",strtotime($old_date[0]." ".$xdate[2]." ".$xdate[3])); $enddate = date("y-m-d",strtotime($old_date[1])); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -