Skip to content

Instantly share code, notes, and snippets.

@micheltem
Created February 4, 2017 11:16
Show Gist options
  • Save micheltem/4d49cd3fa6a0ba9a361b01fe3270da84 to your computer and use it in GitHub Desktop.
Save micheltem/4d49cd3fa6a0ba9a361b01fe3270da84 to your computer and use it in GitHub Desktop.
Formatting dates in pure js, no libs
(new Date()).toString().replace(/\S+\s(\S+)\s(\d+)\s(\d+)\s.*/,'$2 $1 $3');
// date will be formatted as "14-Oct-2015" (pass any date object in place of 'new Date()')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment