Last active
March 28, 2016 13:44
-
-
Save amuhororo/e65ec688f4925548d032 to your computer and use it in GitHub Desktop.
libs.js 日付・時間をを2桁にする
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
$.getNowTime = function() { | |
var nowdate = new Date(); | |
var h = nowdate.getHours(); | |
var m = nowdate.getMinutes(); | |
var s = nowdate.getSeconds(); | |
//↓を追加 | |
if(h < 10) { h = "0" + h; } | |
if(m < 10) { m = "0" + m; } | |
if(s < 10) { s = "0" + s; } | |
return h + ":" + m + ":" + s; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment