Formatting Characters for the date() Function for Hour
Character Description
h Hour in 12-hour format, with leading zero (two digits).
g Hour in 12-hour format (no leading zero).
H Hour in 24-hour format, with leading zero (two digits).
G Hour in 24-hour format (no leading zero).
a am/pm (lowercase).
A AM/PM (uppercase).
O(uppercase o) String representation of the difference in hours between local time and GMT/UTC (for example, +1000, 0500).
Related examples in the same category