Skip to main content

ResQ.Protocols.ProtocolExtensions

ProtocolExtensions.ToUnixMs(this DateTimeOffset) Method

Converts a System.DateTimeOffset to a Unix timestamp in milliseconds.

Parameters

dateTime System.DateTimeOffset The date and time to convert.

Returns

System.Int64
The Unix timestamp in milliseconds since January 1, 1970 UTC.

Example

Remarks

This method converts a System.DateTimeOffset to Unix time in milliseconds, which is commonly used in protobuf messages, JSON APIs, and JavaScript interop. The conversion accounts for the offset and returns the UTC-based timestamp.