golang-module / carbon

A simple, semantic and developer-friendly golang package for time

Home Page:https://pkg.go.dev/github.com/golang-module/carbon/v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ParseByFormat not supported "U" format

JKeita opened this issue · comments

Hello,

I encountered an issue with the following code:

t := c.ParseByFormat("1699677240", "U").Timestamp()
fmt.Println(t)

golang version: 1.21

carbon version: v2.2.14
time zone:PRC

I expected to get:

1699677240

But I actually get:

0

Thanks!

It will fix in next version, currently you can use the following method:

t := c.CreateFromTimestamp(1699677240).Timestamp()
fmt.Println(t) // 1699677240

v2.3.1 has been released