Add time formatting
This commit is contained in:
parent
b6550b9032
commit
7f782f3b1e
17
time/time.go
17
time/time.go
@ -50,4 +50,21 @@ func Time() {
|
|||||||
f(now.Add(-diff))
|
f(now.Add(-diff))
|
||||||
|
|
||||||
epoch()
|
epoch()
|
||||||
|
timeFormatting()
|
||||||
|
}
|
||||||
|
|
||||||
|
func timeFormatting() {
|
||||||
|
now := time.Now()
|
||||||
|
t1, _ := time.Parse(
|
||||||
|
time.RFC3339,
|
||||||
|
"2023-12-25T10:00:00+05:30",
|
||||||
|
)
|
||||||
|
f(t1)
|
||||||
|
|
||||||
|
// Example string should match the datetime: Monday January 02 2006 15:04:05
|
||||||
|
// (this resembles month:1 day:2 hour:3 minute:4 seconds:5 year:6)
|
||||||
|
f("Custom format:", now.Format("2006/1/2"))
|
||||||
|
f("Custom format:", now.Format("Monday, 02 Jan"))
|
||||||
|
f("Custom format:", t1.Format("Monday, _2 Jan"))
|
||||||
|
f("Custom format:", t1.Format("Monday, 2/01/2006"))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user