DateTimeExtensions Class

Provides extension methods for the DateTime type.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 7.0.0
C#
public static class DateTimeExtensions
Inheritance
Object    DateTimeExtensions

Methods

AsLocal Converts the specified dateTime to a local time. Unlike DateTime.ToLocalTime, this method does not treat DateTime instances with Unspecified Kind as UTC times.
AsUtc Converts the specified dateTime to UTC time. Unlike DateTime.ToUniversalTime, this method does not treat DateTime instances with Unspecified Kind as local times.
FromUnixMilliseconds Gets a Utc DateTime from the milliseconds elapsed since the Unix Epoch time (1970-01-01T00:00Z).
FromUnixSeconds Gets a Utc DateTime from the seconds elapsed since the Unix Epoch time (1970-01-01T00:00Z).
ToUnixMilliseconds Gets the time elapsed since the Unix Epoch time (1970-01-01T00:00Z) in milliseconds, not counting leap seconds.
ToUnixSeconds Gets the time elapsed since the Unix Epoch time (1970-01-01T00:00Z) in seconds, not counting leap seconds.

See Also