Created
February 4, 2017 11:16
-
-
Save micheltem/4d49cd3fa6a0ba9a361b01fe3270da84 to your computer and use it in GitHub Desktop.
Formatting dates in pure js, no libs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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