Last active
October 31, 2016 13:06
-
-
Save infoscigeek/8f1ad5ede827c3624e4f48df1b0eca3c to your computer and use it in GitHub Desktop.
Reformatting poorly inputted data and displaying it properly. (In this case, minute and hour fields were stored separately)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
//assign variables | |
$start_hour_field = get_field_object('start_hour'); | |
$starthour = $start_hour_field['value']; | |
$start_min_field = get_field_object('start_min'); | |
$startmin = $start_min_field['value']; | |
$end_hour_field = get_field_object('end_hour'); | |
$endhour = $end_hour_field['value']; | |
$end_min_field = get_field_object('end_min'); | |
$endmin = $end_min_field['value']; | |
?> | |
<td> | |
<? | |
//display as 08:15 A.M. | |
if ($starthour>=12) | |
{ | |
echo $starthour - 12; | |
} | |
else { | |
echo $starthour; | |
} | |
?> | |
: | |
<?php echo $startmin; ?> | |
<?if ($starthour>=12) | |
{ | |
echo " P.M."; | |
} | |
else { | |
echo " A.M."; | |
} | |
?> | |
</td> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment