How do you display a JavaScript datetime object in the 12 hour format (AM/PM)?
If you don't need to print the am/pm, I found the following nice and concise:
var now = new Date(); var hours = now.getHours() % 12 || 12; // 12h instead of 24h, with 12 instead of 0.
This is based off @bbrame's answer.