AWS SDK Version 4 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Converts a DateTime to Unix epoch seconds, keeping millisecond precision (for example 1756149554.123). Whole seconds carry no fractional part.

Namespace: Amazon.Util
Assembly: AWSSDK.Core.dll
Version: 3.x.y.z

Syntax

C#
public Decimal ConvertToUnixEpochSecondsDecimal(
         DateTime dateTime
)

Parameters

dateTime
Type: System.DateTime

Return Value


Type: Decimal

Remarks

Returns System.Decimal rather than System.Double so that the value serializes to the same digits on every target framework: System.Text.Json formats a double with "G17" on .NET Framework/netstandard2.0 (1756149554.123 renders as 1756149554.1229999) but shortest-round-trippable on .NET Core.

Version Information

.NET:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer