Created
May 2, 2017 09:12
-
-
Save unclechen/89bb471b9e8a0195bd61d201c4ed2375 to your computer and use it in GitHub Desktop.
js获取`yymmdd`格式的日期
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 path = require("path"); | |
var currentDate = new Date(); | |
var year = currentDate.getFullYear(); | |
var month = currentDate.getMonth() + 1; | |
month = month < 10 ? '0' + month : month; | |
var day = currentDate.getDate(); | |
day = day < 10 ? '0' + day : day; | |
var date = year + month + day; | |
console.log(date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment