Created
November 1, 2009 11:26
-
-
Save lolicsystem/223481 to your computer and use it in GitHub Desktop.
JSで昨日の日付表す6桁の数値を得てみる
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
// | |
// 昨日の日付を表す6桁の数値を表示する | |
// | |
var uYear, uMon, uDate; | |
var nt = new Date(); | |
nt.setTime(nt.getTime() - 86400000); | |
uYear = ("00" + (nt.getYear() - 100).toString()).slice(-2); | |
uMon = ("00" + (nt.getMonth() + 1).toString()).slice(-2); | |
uDate = ("00" + nt.getDate() .toString()).slice(-2); | |
var uYesterday = uYear + uMon + uDate; | |
alert(uYesterday); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment