Last active
August 29, 2015 14:25
-
-
Save vishalkardode/429b1213a3990867bda4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| var date = new Date(); | |
| var options = { | |
| weekday: "short", | |
| year: "numeric", | |
| month: "2-digit", | |
| day: "numeric" | |
| }; | |
| date.toLocaleDateString("en", options);//en is language option, you may specify.. | |
| /* | |
| Option Values and sample output | |
| weekday narrow M | |
| short Mon | |
| long Monday | |
| year 2-digit 01 | |
| numeric 2001 | |
| month 2-digit 01 | |
| numeric 1 | |
| narrow J | |
| short Jan | |
| long January | |
| day 2-digit 01 | |
| numeric 1 | |
| hour 2-digit 12 AM | |
| numeric 12 AM | |
| minute 2-digit 0 | |
| numeric 0 | |
| second 2-digit 0 | |
| numeric 0 | |
| timeZoneName short 1/1/2001 GMT+00:00 | |
| long 1/1/2001 GMT+00:00 | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment