Skip to content

Commit

Permalink
added utility to return current day, month, year as integer values
Browse files Browse the repository at this point in the history
  • Loading branch information
JustIceO7 committed Oct 2, 2024
1 parent 2a8664e commit aeb5f9b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/utils/time.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package utils

import (
"time"
)

// GetTime looks at current time and returns day, month, year as Integers
func GetTime() (int, int, int) {
currentTime := time.Now()

parsedTime, _ := time.Parse("02-01-2006", currentTime.Format("02-01-2006"))

day := parsedTime.Day()
month := int(parsedTime.Month())
year := parsedTime.Year()

return day, month, year
}

0 comments on commit aeb5f9b

Please sign in to comment.