Created
April 17, 2018 03:07
-
-
Save lordloh/3e824b9539c4169dce6c49fe87a4dda6 to your computer and use it in GitHub Desktop.
A snippet to get the local date in JavaScript
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 today = new Date(); | |
var localToday = new Date(today.getTime()-today.getTimezoneOffset()*60000); | |
var localToday_str=localToday.toISOString().substring(0, 10); | |
console.log(localToday_str); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment