Hi guys.. can any body teach me how to convert date and time formats? example if the format of date in the database is 2010-02-12 and i want to convert it to Febuary 12, 2010 to be shown to the users.. and in time, if the format is in 24hrs and i want to change it to 12hrs format..
strtotime() will just give you the unix timestamp for the date. You have to use date() to convert the timestamp intot the format you want. So for what you want: date("F j, Y",strtotime("2010-03-00")); PHP:
new problem: how can i get the duration of a StartTime variable and an EndTime variable.. example if starttime is 2pm and endtime is 3:30pm.. how can i get the duration from starttime to endtime? so i'd be able to get the hours and minutes to be stored on different variables?
<?php $start = strtotime('2010-02-18 02:00:00'); $end = strtotime('2010-02-18 03:30:00'); $total = $end - $start; //Seconds echo $total .' seconds. '; echo $total/60 . ' minutes. '; echo $total/3600 . ' hours. '; ?>