Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

time: Now is not accurate on playground #10663

Closed
kgao opened this issue May 1, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@kgao
Copy link

commented May 1, 2015

Context: /flowcontrol/10

Today is Friday, May 1st 2015...
It output wrong time use go's time package.


import (
"fmt"
"time"
)

func main() {
today := time.Now().Weekday()
fmt.Println("When's Today?", today)
t := time.Now()
fmt.Println("What's the time now?", t)
}


When's Today? Tuesday
What's the time now? 2009-11-10 23:00:00 +0000 UTC

@kgao kgao changed the title time.Now().Weekday() not accurate time.Now() not accurate May 1, 2015

@davecheney

This comment has been minimized.

Copy link
Contributor

commented May 1, 2015

I'm assuming you ran this program in the Go playground.

http://play.golang.org/p/_s5f33sTaH

The time in the playground is fixed, it is always the date and time of the Go announcement.

In future, this question is best directed to the mailing list, the issue tracker is for bugs.

@davecheney davecheney closed this May 1, 2015

@mikioh mikioh changed the title time.Now() not accurate time: Now is not accurate on playground May 2, 2015

@kingjolab

This comment has been minimized.

Copy link

commented Jan 29, 2016

time.Now()
is not accurate, when I write it to mongodb.
and when I compare with python time.now() function,

@davecheney

This comment has been minimized.

Copy link
Contributor

commented Jan 29, 2016

@kingjolab

The time in the playground is fixed, it is always the date and time of the Go announcement.

In future, this question is best directed to the mailing list, the issue tracker is for bugs.

@golang golang locked and limited conversation to collaborators Feb 3, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.