feat: add DaysBetween in datetime package

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

No files matched your search

+9
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
}