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?

saaabotage
  • 53
  • 1
  • 5

1 Answers1

9

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)

korakot
  • 37,818
  • 16
  • 123
  • 144
  • 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())` – Hugues Dec 20 '20 at 22:40
  • To anonymous user, here is list of [IANA Timezone names](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List) – Rajesh Swarnkar Apr 01 '22 at 13:56