DateTimeExtensionsToUnixSeconds Method
Gets the time elapsed since the Unix Epoch time (1970-01-01T00:00Z) in seconds, not counting leap seconds.
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public static long ToUnixSeconds(
this DateTime value
)
<ExtensionAttribute>
Public Shared Function ToUnixSeconds (
value As DateTime
) As Long
public:
[ExtensionAttribute]
static long long ToUnixSeconds(
DateTime value
)
[<ExtensionAttribute>]
static member ToUnixSeconds :
value : DateTime -> int64
- value DateTime
- A DateTime value to get the Unix time from.
Int64The number of seconds that have elapsed since 1970-01-01T00:00Z.In Visual Basic and C#, you can call this method as an instance method on any object of type
DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This method is similar to DateTimeOffset.ToUnixTimeSeconds
but is available even below .NET Framework 4.6.
If value is a Local time, then its Kind is converted to UTC first.
This method returns a negative value for times before 1970-01-01T00:00Z.