티스토리 뷰

공부

[MacOSX] ISO8601

승가비 2022. 8. 6. 06:47
728x90
zone=$(date +%z)
datetime=$(date +%Y-%m-%dT%H:%M:%S)
iso=$datetime${zone:0:3}:${zone:3:2}

echo $iso

2022-08-06T06:46:18+09:00

https://www.vankuik.nl/2019-04-23_ISO_date_on_macOS

 

vankuik.nl: 2019-04-23 ISO date on macOS

To print the current date in ISO 8601 format on macOS: $ date +%Y-%m-%dT%H:%M:%S 2019-04-23T14:44:46 To print it with the timezone information, append %z. $ date +%Y-%m-%dT%H:%M:%S%z 2019-04-23T14:44:42+0200 Note that in the last case, you're missing the c

www.vankuik.nl

 

728x90
댓글