Skip to content

Instantly share code, notes, and snippets.

@tomhodgins
Last active December 27, 2016 20:56
Show Gist options
  • Save tomhodgins/6f6cdbd1a7a2e8703c4ccc03c25dae21 to your computer and use it in GitHub Desktop.
Save tomhodgins/6f6cdbd1a7a2e8703c4ccc03c25dae21 to your computer and use it in GitHub Desktop.
var date = new Date()
var j = date.getDate()
var suf = ['th', 'st', 'nd', 'rd']
var v = j
var S = (suf[(v-20) % 10] || suf[v] || suf[0])
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
var F = months[date.getMonth()]
var Y = date.getFullYear()
var formatted_date = (F + ' ' + j+S + ', ' + Y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment