diff --git a/mysql/collection.go b/mysql/collection.go
index 68620251fc30d84a55bad32ec5853174016377c2..6f7872b50887f240442c69e191cd3627a322647d 100644
--- a/mysql/collection.go
+++ b/mysql/collection.go
@@ -414,7 +414,7 @@ func toInternal(val interface{}) string {
 	case time.Time:
 		return t.Format(DateFormat)
 	case time.Duration:
-		return fmt.Sprintf(TimeFormat, int(t.Hours()), int(t.Minutes())%60, int(t.Seconds())%60, t.Nanoseconds())
+		return fmt.Sprintf(TimeFormat, int(t/time.Hour), int(t/time.Minute%60), int(t/time.Second%60), t%time.Second/time.Millisecond)
 	case bool:
 		if t == true {
 			return "1"
diff --git a/postgresql/collection.go b/postgresql/collection.go
index 6539fb0f85ada81f6cddc3e69056f4bcaed9ec22..c5970b4a9311605b74352d50d72f52fa60643d49 100644
--- a/postgresql/collection.go
+++ b/postgresql/collection.go
@@ -430,7 +430,7 @@ func toInternal(val interface{}) string {
 	case time.Time:
 		return t.Format(DateFormat)
 	case time.Duration:
-		return fmt.Sprintf(TimeFormat, int(t.Hours()), int(t.Minutes())%60, int(t.Seconds())%60, uint64(t.Nanoseconds())%1e9)
+		return fmt.Sprintf(TimeFormat, int(t/time.Hour), int(t/time.Minute%60), int(t/time.Second%60), t%time.Second/time.Millisecond)
 	case bool:
 		if t == true {
 			return "1"
diff --git a/sqlite/collection.go b/sqlite/collection.go
index e450cc8823fc20bbf9dcbb9b7b16d61100fcc580..89ccc4366349c7d5a561acfe1e8e5fbbf2114897 100644
--- a/sqlite/collection.go
+++ b/sqlite/collection.go
@@ -417,7 +417,7 @@ func toInternal(val interface{}) string {
 	case time.Time:
 		return t.Format(DateFormat)
 	case time.Duration:
-		return fmt.Sprintf(TimeFormat, int(t.Hours()), int(t.Minutes())%60, int(t.Seconds())%60, uint64(t.Nanoseconds())%1e9)
+		return fmt.Sprintf(TimeFormat, int(t/time.Hour), int(t/time.Minute%60), int(t/time.Second%60), t%time.Second/time.Millisecond)
 	case bool:
 		if t == true {
 			return "1"