When using the AWS get-metric-statistics command, the following timestamp format is returned.
2021-06-23T09:48:00Z
This time is in UTC 0, and I want to convert this value to a unix timestamp In Shell Script.
I tried a lot of this and that, but it didn't work.
So, I ask for your help... Thank you.
What I tried
utctimestamp=`TZ=UTC date -d "$timestamp" +%s `
=> date: invalid date ‘"2021-06-23T10:12:00Z"’
utctimestamp=$(TZ="UTC" date -j -f "+%Y-%m-%dT%H:%M:%SZ" "$timestamp" "+%s")
=> date: invalid option -- 'j'
utctimestamp=`date -d -u "$timestamp" +%s `
=> date: invalid date ‘"2021-06-23T10:12:00Z"’
and so on..