Created
October 21, 2015 21:27
-
-
Save sdanna/503e2c6b5c3a111332b3 to your computer and use it in GitHub Desktop.
Helper Functions for Time formatting
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 characters
private String getAmPm(int hourOfDay) { | |
return (hourOfDay >= 12) ? "PM" : "AM"; | |
} | |
private int get12HourFormat(int hourOfDay) { | |
if (hourOfDay == 0) return 12; | |
return (hourOfDay <= 12) ? hourOfDay : hourOfDay - 12; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment