time.Now().Unix() returns same unix time on every run
aman00323 opened this issue · 1 comments
aman00323 commented
-
I have been trying to use
time. Now().Unix()
but on every run, it returns the same timestamp. -
Do we have to explicitly specify the timezone to be followed?
-
Here is below example that I was expecting to run
x1unix commented
@aman00323 This is related to how official Go playground - works. See Stack Overflow article
In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
If you want to use actual time and date - use WebAssembly backend which will run Go code in your browser: