LoginSignup
0
0

More than 3 years have passed since last update.

Golang:現在の日時を unixtime で取得する

Posted at
package main

import (
    "fmt"
    "time"
)

func main() {
    now := time.Now().Unix()  // ココ
    fmt.Println(now)
    fmt.Println(time.Unix(now, 0))
}

結果

$ go run main.go
1594910484
2020-07-16 23:41:24 +0900 JST
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0