mirror of
https://github.com/duke-git/lancet.git
synced 2026-11-16 05:12:11 +08:00
feat: add DaysBetween in datetime package
This commit is contained in:
1 parent
5e3337a52e
commit
48244d6711
5 files changed
+127
-10
No files matched your search
@@ -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
|
||||
}
|
||||
Reference in new issue
Block a user