javascript dates

March 01, 2014

Javascript Date objects have zero indexed months but not dates.

> (new Date(2014, 0, 1)).strftime("%b %d, %Y")
"Jan 1, 2014"
> (new Date(2013, 11, 31)).strftime("%b %d, %Y")
"Dec 31, 2013"
> (new Date(2014, 0, 0)).strftime("%b %d, %Y")
"Dec 31, 2013"

Wat?

Resources

Javascript strftime


Katie Leonard

Mostly Katie explaining things to herself.

© 2025