// ------------------------------------------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See LICENSE in the repo root for license information. // ------------------------------------------------------------------------------------------------- using System; namespace Microsoft.Health.Core.Extensions; public static class DateTimeExtensions { /// /// Truncates a DateTime to millisecond precision /// /// The DateTime /// The truncated dateTime public static DateTime TruncateToMillisecond(this DateTime dateTime) { return new DateTime(dateTime.Ticks / TimeSpan.TicksPerMillisecond * TimeSpan.TicksPerMillisecond, dateTime.Kind); } }