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. Required fields are marked *

You May Also Like…