1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

feat: add DaysBetween in datetime package

This commit is contained in:
dudaodong
2024-09-09 10:55:18 +08:00
parent 5e3337a52e
commit 48244d6711
5 changed files with 127 additions and 10 deletions

View File

@@ -411,3 +411,12 @@ func getCallerName() string {
return fullName
}
// DaysBetween returns the number of days between two times.
// Play: todo
func DaysBetween(start, end time.Time) int {
duration := end.Sub(start)
days := int(duration.Hours() / 24)
return days
}