Using GNU date to convert between timezones

Written by James McDonald

January 1, 2021

Just being doing an AWS EC2 volume enlargement and the output of StartTime is in UTC

aws --profile gap ec2 describe-volumes-modifications --volume-id vol-XXXXXXXXXXXXXXXXXXXXX

Output:

{
    "VolumesModifications": [
        {
            "VolumeId": "vol-XXXXXXXXXXXXXXXXXXXXX",
            "ModificationState": "optimizing",
            "TargetSize": 200,
            "TargetIops": 600,
            "TargetVolumeType": "gp2",
            "OriginalSize": 80,
            "OriginalIops": 240,
            "OriginalVolumeType": "gp2",
            "Progress": 52,
            "StartTime": "2021-01-01T01:06:48+00:00"
        }
    ]
}

What is the local time for the “StartTime” value in the output of the aws cli command

GNU date command

Set the TZ environment variable to your timezone

TZ=Australia/Melbourne date -d "2021-01-01T01:06:48+00:00" -Iseconds

Output:

2021-01-01T12:06:48+11:00

0 Comments

Submit a Comment

Your email address will not be published.

You May Also Like…

ZPL SBPL

Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it...

PHP Iterators

Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many...

PHP array_map Multiple Arrays

array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each...