Skip to content
Discussion options

You must be logged in to vote

Added ParseWithLayouts and ParseWithFormats methods in v2.6.1
https://github.com/dromara/carbon?tab=readme-ov-file#parse-a-time-string-as-a-carbon-instance-with-layouts
https://github.com/dromara/carbon?tab=readme-ov-file#-parse-a-time-string-as-a-carbon-instance-with-formats

c := carbon.ParseWithLayouts("2020|08|05 13|14|15", []string{"2006|01|02 15|04|05", "2006|1|2 3|4|5"})
fmt.Println(c.ToString())
fmt.Println(c.CurrentLayout())

// Output:
// 2020-08-05 13:14:15 +0000 UTC
// 2006|01|02 15|04|05

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@YiuTerran
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YiuTerran
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants