Formatting JavaScript dates. Unashamedly nicked from https://gist.github.com/atesgoral/1005948 via http://www.140byt.es/keywords/date. See the linked Gist for more documentation.