ソースを参照

TimeToExcelTime is tuncating time to second

simulot 8 年 前
コミット
c3cef27bce
1 ファイル変更1 行追加1 行削除
  1. 1 1
      cell.go

+ 1 - 1
cell.go

@@ -119,7 +119,7 @@ func TimeToUTCTime(t time.Time) time.Time {
 }
 
 func TimeToExcelTime(t time.Time) float64 {
-	return float64(t.Unix())/86400.0 + 25569.0
+	return float64(t.UnixNano())/8.64e13 + 25569.0
 }
 
 // SetDate sets the value of a cell to a float.