Changing the System Time in Google Colaboratory
Asked Answered
M

1

5

I would like to use my local time as the System Time in Google Colab, but I believe by default it is set to UTC time as indicated here: Current Date Format

How am I able to change the system time to my local time?

Myriammyriameter answered 30/4, 2019 at 10:3 Comment(0)
I
10

Here's how to do it. For me, I live in Asia/Bangkok

!rm /etc/localtime
!ln -s /usr/share/zoneinfo/Asia/Bangkok /etc/localtime
!date

Now I get Tue Apr 30 20:12:30 +07 2019. You can see the list of timezones by

!ls -al /usr/share/zoneinfo

And go into sub-directories for each group. (or simply search google)

Imperfection answered 30/4, 2019 at 13:15 Comment(2)
It seems that the Colab runtime does not notice the timezone change until the runtime is restarted, as can be seen by evaluating time.localtime(time.time())Gorrono
To anonymous user, here is list of IANA Timezone namesDoro

© 2022 - 2024 — McMap. All rights reserved.