Page 1 of 1

time formatting

Posted: Fri Apr 15, 2005 4:55 am
by gurjit
Hi all,

I have in a database times displayed like

"2:30 to 4:30"
"10:00 to 12:00"

all these times are daytime times and i need to manipulate the data so that i can represent the above into start and end times in 24 hour. so the above would be presented as:


start time
14:30
10:00

end time
16:30
12:00


How can i do this. I tried the following to represent 2:30 and it displays 02:30 and not 14:30:

Code: Select all

<?php

$timedd = &quote;2:30&quote;;

echo date(&quote;H:i&quote;, strtotime($timedd));

?>
any ideas how i can achieve this?

Posted: Fri Apr 15, 2005 6:28 am
by Bennettman
$timedd should either be "14:30" or "2:30pm". As it is, PHP recognises it as 2:30 AM.