DateTimeExtensions¶
Namespace:
SideXP.Core
Extension functions for DateTime values.
Methods¶
ToTimestamp(DateTime)¶
Converts a given time into the number of elapsed milliseconds since the Unix epoch (1970-01-01 UTC). The DateTime's wall-clock value is used as-is (its DateTimeKind is not normalized), so pass a UTC value (e.g. UtcNow) for a true Unix timestamp.
Parameters
time: The time to convert.
Returns
Returns the number of elapsed milliseconds.
ToTimestampSeconds(DateTime)¶
Converts a given time into the number of elapsed seconds since the Unix epoch (1970-01-01 UTC).
Returns
Returns the number of elapsed seconds.