IT Talks

[๋ฆฌ๋ˆ…์Šค] date ๋ช…๋ น์œผ๋กœ timestamp ๋ณ€ํ™˜ํ•˜๊ธฐ

OkOJJ 2023. 2. 14. 16:30

1. timestamp ๊ฐ’์œผ๋กœ ์›ํ•˜๋Š” ๋‚ ์งœ ํ˜•ํƒœ๋กœ ๋ณ€ํ™˜ํ•˜๊ธฐ

$ date -d '1970-01-01 1676360315 sec'
 2023. 02. 14. (ํ™”) 07:38:35 KST

$ date -d '1970-01-01 1676360315 sec' +'%Y-%m-%d %H:%M:%S'
2023-02-14 07:38:35

* ๊ฒฐ๊ณผ๋Š” ์‹œ์Šคํ…œ Timezone์— ๋งž์ถฐ์„œ ํ‘œ์‹œ๋จ

 

2. ๋‚ ์งœ ํ˜•์‹์œผ๋กœ timestamp ๊ฐ’ ๊ตฌํ•˜๊ธฐ (1๋ฒˆ๊ณผ ๋ฐ˜๋Œ€)

$ date -d '2022-02-14' +%s
1644764400

 

 

 

728x90