Math.abs()
: 절대값 반환Math.round()
: 소수점 반올림Math.ceil()
: 올림Math.floor()
: 내림Math.sqrt()
: 제곱근 반환 (Math.sqrt(9) === 3
)Math.random()
: [0,1) 중 난수 반환Math.pow()
: 거듭제곱한 결과 반환 (Math.sqrt(a,b) === a^b
)Math.max()
: 최대값 반환Math.min()
: 최소값 반환날짜와 시간을 나타내는 정수값을 갖는다.
new Date()
: 현재 날짜와 시간을 가지는 객체
new Date(ms)
: ms만큼 기점에서 경과한 날짜 시간을 나타내는 객체
new Date(dateString)
: 입력한 문자열에 맞는 날짜 시간을 나타내는 객체
new Date(yy,mm[,dd,hh,mm,ss,ms])
: 인수로 전달된 날짜와 시간을 나타내는 객체
Date.now()
: 기점 ~ 현재까지의 경과시간을 ms로 나타낸다.Date.parse(str)
: 기점 ~ str까지의 경과시간을 ms로 나타낸다.Date.UTC(yy,mm[,dd,hh,mm,ss,ms])
: 기점부터의 경과시간을 ms로 나타낸다.Date.prototype.set{FullYear, Month, Date}(arg)
: 해당 날짜 단위부터 작은 단위까지 설정
Date.prototype.get{FullYear, Month, Date}()
: 해당 날짜 단위를 가져온다
Date.prototype.getDay()
: 요일을 확인한다. (0: 일, 1: 월, ..., 6: 토)
Date.prototype.set{Hours, Minutes, Seconds, Milliseconds}(arg)
: 해당 시간 단위부터 작은 단위까지 설정
Date.prototype.get{Hours, Minutes, Seconds, Milliseconds}()
: 해당 시간 단위를 가져온다
Date.prototype.getTime()
: 기점부터 경과시간을 ms로 나타낸다.
Date.prototype.setTime(arg)
: 기점부터 arg까지 경과된 날짜 시간으로 설정
Date.prototype.getTimezoneOffset()
: locale과 UTC와의 시간차이를 분단위로 반환한다.
*60 (m -> s) * 1000 (m -> ms)
를 해야한다.const UTCtoKST = (utc) => new Date(utc.getTime() -new Date().getTimezoneOffset()*60*1000) // UTC: 2021-12-27T13:54:18.097Z -> KST: 2021-12-27T22:54:18.097Z
Date.prototype.toString()
: 요일 월 일 년도 HH:MM:SS GTM+0900 (KST)
'Sat Feb 27 2021 22:47:58 GMT+0900 (Korean Standard Time)'
Date.prototype.toDateString()
: 요일 월 일 년도
만 리턴
Date.prototype.toTimeString()
: HH:MM:SS GTM+0900 (KST)
만 리턴
Date.prototype.toISOString()
: ISO 형식으로 리턴
'2021-02-27T13:47:58.291Z'
Date.prototype.toLocaleString(arg)
: arg에 따른 표기로 리턴
> date.toLocaleString()
> '2/27/2021, 10:47:58 PM'
> date.toLocaleString('ko-KR')
> '2021. 2. 27. 오후 10:47:58'