Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Convert Unix timestamp in PST to IST

I am trying to convert any Unix epoch time value into IST timezone.

Unix date:
date -d@1509872957 gives Sun Nov  5 01:09:17 PST 2021


for UTC:
date -d@1509872957 -u gives Sun Nov  5 09:09:17 UTC 2017

Is there any similar way to convert for IST time-zone. I tried using command TZ='Asia/Kolkata' date, but I am not able to work it out for any epoch.
by

1 Answer

Kajalsi45d
For you as a user, you can update your view of the date/time with this command
export TZ='Asia/Kolkata'

If you have a time in seconds since the epoch you can either run the export command above or give the setting to date each time you use it


date --utc --date '@1509872957'                # Sun  5 Nov 09:09:17 UTC 2017
date --date '@1509872957' # Sun 5 Nov 09:09:17 GMT 2017 (my timezone)

TZ='Asia/Kolkata' date --date '@1509872957' # Sun 5 Nov 14:39:17 IST 2017

export TZ='Asia/Kolkata'
date --date '@1509872957' # Sun 5 Nov 14:39:17 IST 2017 (your timezone)

With sufficient rights you can update the system's view of the time, since it seems to be PST. On my Debian-based system it's tzselect for an interactive selection.

Login / Signup to Answer the Question.