1
I have no clue if anyone has done this or if there is even a need for it. I've tried searching for this type of hack but could not find it so I just played around with the code till I got what I wanted.
Reason for this hack is because of my users. My users range from 10 years old to 50. Such a wide range and alot of the younger viewers of my site dont understand 24 hour time. I myself have no problem using 24 hour format. Even my work schedule is in 24 hour here in the states. So I went ahead and changed the formdatetime.php file.
Original formdatetime.php
$timearray = array();
for ($i = 0; $i < 24; $i++) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = ($i * 3600) + ($j * 60);
$timearray[$key] = ($j != 0) ? $i.':'.$j : $i.':0'.$j;
}
}
ksort($timearray);
Replace with
$timearray = array();
// AM Array **************************************************************************************//
for ($i = 0; $i < 12; $i++) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = ($i * 3600) + ($j * 60);
if ($i == 0){
$timearray[$key] = ($j != 0) ? '12'.':'.$j.' am' : '12'.':0'.$j.' am';
}
else{
$timearray[$key] = ($j != 0) ? $i.':'.$j.' am' : $i.':0'.$j.' am';
}
}
}
// PM Array **************************************************************************************//
for ($i = 12; $i < 24; $i++) {
for ($j = 0; $j < 60; $j = $j + 10) {
$key = ($i * 3600) + ($j * 60);
if ($i > 12){
$timearray[$key] = ($j != 0) ? ($i - 12).':'.$j.' pm' : ($i - 12).':0'.$j.' pm';
}
else{
$timearray[$key] = ($j != 0) ? $i.':'.$j.' pm' : $i.':0'.$j.' pm';
}
}
}
ksort($timearray);
I am not much a programer. So let me know if there are any problems with it.