250x250
Notice
Recent Posts
Recent Comments
- Today
- Total
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- nginx
- flutter
- JavaScript
- mongodb
- certbot
- TailwindCSS
- wil
- mongoose
- EC2
- TypeScript
- css
- atlas
- async
- AWS
- til
- jsonwebtoken
- findByIdAndDelete
- single quote
- await
- RDS
- Find
- double quote
- moment
- clipBehavior
- Nodejs
- MYSQL
- https
- sequelize
- Express
- Node.js
Link
Archives
반응형
목록timezone (1)
기억 휘발 방지소
[Node.js / Sequelize] created_at, updated_at 시간을 한국시간대로 표기하기
📌 timestamps 모델을 생성할 때 'timestamps: true' 옵션을 주면 데이터베이스에 created_at, updated_at을 자동으로 생성해준다. 현재시간을 created_at에 자동으로 넣어주는데 문제는 표준시간이 UTC+00:00라는 것이다. 즉, 한국시간보다 9시간 전 시간을 넣어준다는 것이다. 그래서 아래 이미지에 id 6번의 created_at처럼 오전 11시에 저장한 데이터가 오전 2시로 찍히는 것이다. 📌 timezone 설정하기 timezone을 설정하면 쉽게 해결할 수 있다. config/config.json 파일에 timezone을 아래처럼 "timezone": "+09:00"을 넣어주면 id 7번 처럼 한국의 현재 시간을 잘 저장할 수 있다. "development..
Web/Node.js
2021. 10. 7. 12:04
반응형