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 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Clear HSTS Settings in CHrome

Open chrome://net-internals/#hsts enter the domain in the query field and click Query to confirm it has HSTS settings...

Ubuntu on Hyper-v

It boils town to installing linux-azure # as root or sudo apt-get update apt-get install linux-azure...