Changed default time format to AMPM

This commit is contained in:
Tom Moor 2013-03-04 21:10:02 -08:00
parent 7e8baad86a
commit 9a9b619e7c
2 changed files with 2 additions and 2 deletions

File diff suppressed because one or more lines are too long

@ -1 +1 @@
package com.sqwiggle { public class Utils { public function Utils() { // constructor code } static public function getFormattedTime(twelveHour:Boolean = false):String { // create time segments var theDate = new Date(); var seconds = theDate.getSeconds(); var minutes = theDate.getMinutes(); var hours = theDate.getHours(); var ampm = ''; // create vars for sec and min var min:String = minutes.toString(); // zero pad min = (min.length == 1) ? '0' + minutes.toString() : min; // convert to am/pm if we need to if (twelveHour) { ampm = (hours >= 12) ? 'pm' : 'am'; hours = (hours >= 13) ? hours - 12 : hours; } // set time string return hours +':'+ min +' '+ ampm; } } }
package com.sqwiggle { public class Utils { public function Utils() { // constructor code } static public function getFormattedTime(twelveHour:Boolean = true):String { // create time segments var theDate = new Date(); var seconds = theDate.getSeconds(); var minutes = theDate.getMinutes(); var hours = theDate.getHours(); var ampm = ''; // create vars for sec and min var min:String = minutes.toString(); // zero pad min = (min.length == 1) ? '0' + minutes.toString() : min; // convert to am/pm if we need to if (twelveHour) { ampm = (hours >= 12) ? 'PM' : 'AM'; hours = (hours >= 13) ? hours - 12 : hours; } // set time string return hours +':'+ min +' '+ ampm; } } }