return mdy_to_ymd(format_oneline($str));
}
+# date is yyyy-mm-dd
+function format_ymd($str) {
+ require_once('code/wfpl/time.php');
+ list($year, $month, $day) = ymd_clean($str);
+ return sprintf('%04u-%02u-%02u', $year, $month, $day);
+}
+
# takes any of: HH :MM HH:MM
# returns decimal number of hours
#
}
}
+# takes eg 12:23am
+# returns decimal number of hours since midnight
+function format_12hr_to_hours($str) {
+ if(eregi('noon', $str)) {
+ return 12;
+ }
+ $hours = format_hours($str);
+ if($hours < 12 && eregi('p', $str)) {
+ $hours += 12;
+ }
+ return $hours;
+}
+
function format_phone($str) {
$str = ereg_replace('[^0-9]', '', $str);