R
R
researcher11112018-06-02 21:59:59
go
researcher1111, 2018-06-02 21:59:59

Time in seconds golang?

Good evening!
The question is this: you need to get the value in seconds of the current date and time. That is, how many seconds have passed since 0 year 0 months 0 days 0 hours 0 seconds until today.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2018-06-02
@researcher1111

  1. Calculate the number of seconds up to Jan 1, 1970 and take it as a constant
    Will this go?

L
lo-fi, 2018-06-02
@hrls

https://golang.org/pkg/time/#Date
https://golang.org/pkg/time/#Since
https://golang.org/pkg/time/#Duration.Seconds

ac := time.Date(0, time.January, 1, 0, 0, 0, 0, time.UTC)
fmt.Printf("seconds %v", time.Since(ac).Seconds())

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question