30μ₯ Date
νμ€ λΉνΈμΈ Dateλ λ μ§μ μκ° κ΄λ ¨ λ©μλλ₯Ό μ 곡νλ λΉνΈμΈ κ°μ²΄ μ΄λ©΄μ μμ±μ ν¨μ λ€.
30.1 Date μμ±μ ν¨μ
Date λ μμ±μ ν¨μλ€. Date μμ±μ ν¨μλ‘ μμ±ν Date κ°μ²΄λ κΈ°λ³Έμ μΌλ‘ νμ¬ λ μ§μ μκ°μ λνλ΄λ μ μκ°μ κ°μ§λ€. νμ¬κ° μλ νΉμ μκ°μ λ€λ£¨κ³ μΆλ€λ©΄ λͺ μμ μΌλ‘ ν΄λΉ μ 보λ₯Ό μΈμλ‘ μ§μ νλ€.
30.1.1 new Date()
μΈμ μμ΄ new μ°μ°μμ νΈμΆνλ©΄ νμ¬ λ μ§μ μκ°μ κ°λ Date κ°μ²΄λ₯Ό λ°ννλ€. λ΄λΆμ μΌλ‘ λ μ§μ μκ°μ λνλ΄λ μ μκ°μ κ°μ§λ§ μ½μμ μΆλ ₯νλ©΄ λ μ§μ μκ° μ 보λ₯Ό μΆλ ₯νλ€.
30.1.2 new Date(milliseconds)
μ«μ νμ μ λ°λ¦¬μ΄λ₯Ό μ λ¬νλ©΄ 1970λ 1μ 1μΌ 0μ 0λΆ 0μ΄λ₯Ό κΈ°μ μΌλ‘ μ λ¬ν λ°λ¦¬μ΄λ§νΌ κ²½κ³Όν λ μ§μ μκ°μ λνλ΄λ Date κ°μ²΄λ₯Ό λ°ννλ€.
30.1.3 new Date(dateString)
λ μ§μ μκ°μ λνλ΄λ λ¬Έμμ΄μ μΈμλ‘ μ λ¬νλ©΄ μ§μ λ λ μ§μ μκ°μ λνλ΄λ Date κ°μ²΄λ₯Ό λ°ννλ€. Date.parse λ©μλμ μν΄ ν΄μ κ°λ₯ν νμμ΄μ΄μΌ νλ€.
30.1.4 new Date(year, month[, day, hour, minute, second, millisecond])
μ°, μ, μΌ, μ, λΆ, μ΄, λ°λ¦¬μ΄λ₯Ό μλ―Ένλ μ«μλ₯Ό μ λ¬νλ©΄ μ§μ λ λ μ§μ μκ°μ λνλ΄λ Date κ°μ²΄λ₯Ό λ°ννλ€. μ°, μμ νμκ°μ΄λ€.
30.2 Date λ©μλ
30.2.1 Date.now
1970λ 1μ 1μΌ κΈ°μ μΌλ‘ νμ¬ μκ°κΉμ§ κ²½κ³Όν λ°λ¦¬μ΄λ₯Ό μ«μλ‘ λ°ννλ€.
30.2.2 Date.parse
1970λ 1μ 1μΌ κΈ°μ μΌλ‘ μ λ¬λ μ§μ μκ°κΉμ§μ λ°λ¦¬μ΄λ₯Ό μ«μλ‘ λ°ννλ€.
30.2.3 Date.UTC
1970λ 1μ 1μΌ κΈ°μ μΌλ‘ μ λ¬λ μ§μ μκ°κΉμ§μ λ°λ¦¬μ΄λ₯Ό μ«μλ‘ λ°ννλ€.
30.2.4 Date.prototype.getFullYear
Date κ°μ²΄μ μ°λλ₯Ό λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.5 Date.prototype.setFullYear
Date κ°μ²΄μ μ°λλ₯Ό λνλ΄λ μ μλ₯Ό μ€μ νλ€. μ, μΌλ μ§μ κ°λ₯
30.2.6 Date.prototype.getMonth
Date κ°μ²΄μ μμ λνλ΄λ μ μλ₯Ό λ°ννλ€. 0μ΄ 1μμ΄λ€.
30.2.7 Date.prototype.setMonth
Date κ°μ²΄μ μμ λνλ΄λ μ μλ₯Ό μ€μ νλ€. μΌλ μ§μ κ°λ₯
30.2.8 Date.prototype.getDate
Date κ°μ²΄μ μΌμ λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.9 Date.prototype.setDate
Date κ°μ²΄μ μΌμ λνλ΄λ μ μλ₯Ό μ€μ νλ€.
30.2.10 Date.prototype.getDay
Date κ°μ²΄μ μμΌμ λνλ΄λ μ μλ₯Ό λ°ννλ€. 0 - μΌμμΌ 6 - μμμΌ
30.2.11 Date.prototype.getHours
Date κ°μ²΄μ μκ°μ λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.12 Date.prototype.setHours
Date κ°μ²΄μ μκ°μ λνλ΄λ μ μλ₯Ό μ€μ νλ€. λΆ, μ΄, λ°λ¦¬μ΄λ μ€μ κ°λ₯
30.2.13 Date.prototype.getMinutes
Date κ°μ²΄μ λΆμ λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.14 Date.prototype.setMinutes
Date κ°μ²΄μ λΆμ λνλ΄λ μ μλ₯Ό μ€μ νλ€. μ΄, λ°λ¦¬μ΄λ μ€μ κ°λ₯
30.2.15 Date.prototype.getSeconds
Date κ°μ²΄μ μ΄μ λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.16 Date.prototype.setSeconds
Date κ°μ²΄μ μ΄λ₯Ό λνλ΄λ μ μλ₯Ό μ€μ νλ€. λ°λ¦¬μ΄λ μ€μ κ°λ₯
30.2.17 Date.prototype.getMilliSeconds
Date κ°μ²΄μ λ°λ¦¬μ΄λ₯Ό λνλ΄λ μ μλ₯Ό λ°ννλ€.
30.2.18 Date.prototype.setMilliSeconds
Date κ°μ²΄μ λ°λ¦¬μ΄λ₯Ό λνλ΄λ μ μλ₯Ό μ€μ νλ€.
30.2.19 Date.prototype.getTime
1970λ 1μ 1μΌμ κΈ°μ μΌλ‘ Date κ°μ²΄μ μκ°κΉμ§ κ²½κ³Όλ λ°λ¦¬μ΄λ₯Ό λ°ννλ€.
30.2.20 Date.prototype.setTime
Date κ°μ²΄μ 1970λ 1μ 1μΌμ κΈ°μ μΌλ‘ κ²½κ³Όλ λ°λ¦¬μ΄λ₯Ό μ€μ νλ€.
30.2.21 Date.prototype.getTimezoneOffset
UTCμ Date κ°μ²΄μ μ§μ λ λ‘μΊ μκ°κ³Όμ μ°¨μ΄λ₯Ό λΆ λ¨μλ‘ λ°ννλ€.
30.2.22 Date.prototype.toDateString
λ¬Έμμ΄λ‘ Date κ°μ²΄μ λ μ§λ₯Ό λ°ννλ€.
30.2.23 Date.prototype.toTimeString
Date κ°μ²΄μ μκ°μ ννν λ¬Έμμ΄μ λ°ννλ€.
30.2.24 Date.prototype.toISOString
ISO 8601 νμμΌλ‘ Date κ°μ²΄μ λ μ§μ μκ°μ ννν λ¬Έμμ΄μ λ°ννλ€.
30.2.25 Date.prototype.toLocaleString
μ λ¬ν λ‘μΊμ κΈ°μ€μΌλ‘ Date κ°μ²΄μ λ μ§μ μκ°μ ννν λ¬Έμμ΄μ λ°ννλ€.
30.2.26 Date.prototype.toLocaleTimeString
μ λ¬ν λ‘μΊμ κΈ°μ€μΌλ‘ Date κ°μ²΄μ μκ°μ ννν λ¬Έμμ΄μ λ°ννλ€.
30.3 Dateλ₯Ό νμ©ν μκ³ μμ
Last updated
Was this helpful?