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

ParseByFormat not supported "U" format #206

Closed
JKeita opened this issue Dec 26, 2023 · 3 comments
Closed

ParseByFormat not supported "U" format #206

JKeita opened this issue Dec 26, 2023 · 3 comments
Labels
Bug Report a reproducible bug or regression

Comments

@JKeita
Copy link

JKeita commented Dec 26, 2023

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!

@JKeita JKeita added the Bug Report a reproducible bug or regression label Dec 26, 2023
@gouguoyin
Copy link
Member

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

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

@gouguoyin
Copy link
Member

v2.3.1 has been released

@gouguoyin
Copy link
Member

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report a reproducible bug or regression
Development

No branches or pull requests

2 participants