You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
var date = new Date(); |
|
|
|
function jsHour(object){ |
|
var hour = date.getHours(); |
|
object.value = changeNumber(hour); |
|
// object.value = changeNumber(time); |
|
} |
|
|
|
function jsTime(object){ |
|
var hour = date.getHours(); |
|
var minute = date.getMinutes(); |
|
var second = date.getSeconds(); |
|
var temp = "" + ((hour > 12) ? hour - 12 : hour); |
|
if(hour==0) temp = "12"; |
|
if(temp.length==1) temp = " " + temp; |
|
temp += ((minute < 10) ? ":0" : ":") + minute; |
|
temp += ((second < 10) ? ":0" : ":") + second; |
|
temp += (hour >= 12) ? " PM" : " AM"; |
|
object.value = temp; |
|
id = setTimeout("jsTime("+object+")",1000); |
|
} |
|
|
|
function jsToday(object, date){ |
|
//ie10,11 호환성 수정 |
|
var year=now.getYear(); |
|
if(year<1900){ |
|
year=now.getFullYear(); |
|
} |
|
var month = (now.getMonth()+1); |
|
// var day = date.getDate(); |
|
var day = date; |
|
|
|
var temp = year; |
|
temp += ((month < 10) ? "-0" : "-") + month; |
|
temp += ((day < 10) ? "-" : "-") + day; |
|
object.value = temp; |
|
} |
|
|
|
function jsDate(object){ |
|
//ie10,11 호환성 수정 |
|
var year=now.getYear(); |
|
if(year<1900){ |
|
year=now.getFullYear(); |
|
} |
|
var month = (now.getMonth()+1); |
|
var day = date.getDate(); |
|
|
|
var temp = year; |
|
temp += ((month < 10) ? "-0" : "-") + month; |
|
temp += ((day < 10) ? "-0" : "-") + day; |
|
object.value = temp; |
|
}
|
|
|