Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DateTimeOffset::ToUnixTimeSeconds Method ()

.NET Framework (current version)
 

Returns the number of seconds that have elapsed since 1970-01-01T00:00:00Z.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

public:
long long ToUnixTimeSeconds()

Return Value

Type: System::Int64

The number of seconds that have elapsed since 1970-01-01T00:00:00Z.

Unix time represents the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). It does not take leap seconds into account.

This method first converts the current instance to UTC before returning its Unix time. For date and time values before 1970-01-01T00:00:00Z, this method returns a negative value.

The following example calls the ToUnixTimeSeconds method to return the Unix time of values that are equal to, shortly before, and shortly after 1970-01-01T00:00:00Z.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.6
Return to top
Show:
© 2017 Microsoft