Skip to content

Commit 59a3357

Browse files
Fix
1 parent 056a614 commit 59a3357

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

csharp/src/Apache.Arrow/Arrays/Date64Array.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ protected override long Convert(DateTime dateTime)
6565

6666
protected override long Convert(DateTimeOffset dateTimeOffset)
6767
{
68-
// The internal value stored for a DateTimeOffset can be thought of as the number of milliseconds,
69-
// in multiples of 86400000, that have passed since the UNIX epoch. It is not the same as what would
70-
// result from encoding the date from the DateTimeOffset.Date property.
71-
long millis = dateTimeOffset.ToUnixTimeMilliseconds();
72-
long days = millis / MillisecondsPerDay;
73-
return (millis < 0 ? days - 1 : days) * MillisecondsPerDay;
68+
return new DateTimeOffset(dateTimeOffset.UtcDateTime.Date, TimeSpan.Zero).ToUnixTimeMilliseconds();
7469
}
7570

7671
#if NET6_0_OR_GREATER

0 commit comments

Comments
 (0)