Skip to content

Instantly share code, notes, and snippets.

@unclechen
Created May 2, 2017 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unclechen/89bb471b9e8a0195bd61d201c4ed2375 to your computer and use it in GitHub Desktop.
Save unclechen/89bb471b9e8a0195bd61d201c4ed2375 to your computer and use it in GitHub Desktop.
js获取`yymmdd`格式的日期
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