Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
Tags
- MSA
- 비주얼 스튜디오 코드
- ChatGPT
- MSK
- V8
- nestjs
- Linux
- html
- NPM
- 함수형프로그래밍
- typescript
- Functional Programming
- nodeJS
- 알고리즘
- Let's Encrypt
- python
- node.js
- 자료구조
- ES6
- Express
- Generics
- vscode
- https
- 파이썬
- docker
- GIT
- stream
- Schema Registry
- Certbot
- javascript
Archives
- Today
- Total
JangBaGeum.gif
[JavaScript]Date Object에서 Year/Month/Date 얻기 본문
var dateObj = new Date();
var month = dateObj.getMonth() + 1; //months from 1-12
var day = dateObj.getDate();
var year = dateObj.getFullYear();
newdate = year + "/" + month + "/" + day;
- getUTCMonth(), getUTCDate(), getUTCFullYear() 등과 같이 UTC가 포함된 것은 UTC기준 Date
- 월(month)은 0부터 시작 (1월은 0, 2월은 1)
- getDay()는 요일(0-6) getDate()는 날짜(1-31)
- getYear()은 현재 연도에서 1900 값을 뺀 값 반환 (현재는 Deprecated)
'ETC > 알고리즘 & 문법' 카테고리의 다른 글
[TypeScript] 제네릭을 이용한 객체 배열 Group by (2) | 2022.11.24 |
---|---|
[JavaScript] ES6 Map() (0) | 2022.11.16 |
[JavaScript] Convert ES6 Iterable to Array (0) | 2022.11.16 |
[FP] 순수 함수와 비 순수 함수 (0) | 2022.10.11 |
[TypeScript] Generics (0) | 2022.07.13 |