Golang时间日期处理

2024-05-07 21:38:09
/
0 点赞
/
205 阅读
2024-05-07

获取当前小时的时间戳

package main

import (
	"fmt"
	"time"
)

func main() {
	now := time.Now()
	rounded := time.Date(now.Year(), now.Month(), now.Day(), now.Hour(), 0, 0, 0, now.Location())

	timestamp := rounded.Unix()
	fmt.Println(timestamp)
}

版权属于:

那棵树看起来生气了

本文链接:

https://dengyb.com/archives/92.html(转载时请注明本文出处及文章链接)

那棵树看起来生气了
参差荇菜,左右流之。窈窕淑女,寤寐求之。
138 文章数
13047 浏览量