Last active
November 21, 2018 05:22
Revisions
-
hjst revised this gist
Jan 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ function format_time(date_obj) { // formats a javascript Date object into a 12h AM/PM time string var hour = date_obj.getHours(); var minute = date_obj.getMinutes(); var amPM = (hour > 11) ? "pm" : "am"; -
hjst renamed this gist
Oct 31, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
hjst created this gist
Oct 31, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ function format_time(date_obj) { // formats a javascript Date object into a 12h am/pm time string var hour = date_obj.getHours(); var minute = date_obj.getMinutes(); var amPM = (hour > 11) ? "pm" : "am"; if(hour > 12) { hour -= 12; } else if(hour == 0) { hour = "12"; } if(minute < 10) { minute = "0" + minute; } return hour + ":" + minute + amPM; }