Table of Contents

Class DateTimeToUnixTimestampValueConverter

Namespace
MADE.Data.Converters
Assembly
MADE.Data.Converters.dll

Defines a value converter from DateTime to a Unix timestamp represented as a long.

public class DateTimeToUnixTimestampValueConverter : IValueConverter<DateTime, long>
Inheritance
DateTimeToUnixTimestampValueConverter
Implements
Inherited Members
Extension Methods

Methods

Convert(DateTime, object?)

Converts the value to a Unix timestamp in seconds.

public long Convert(DateTime value, object? parameter = null)

Parameters

value DateTime

The DateTime value to convert.

parameter object

The optional parameter used to help with conversion.

Returns

long

The Unix timestamp in seconds since the Unix epoch (1970-01-01 00:00:00 UTC).

ConvertBack(long, object?)

Converts a Unix timestamp in seconds back to a DateTime in UTC.

public DateTime ConvertBack(long value, object? parameter = null)

Parameters

value long

The Unix timestamp in seconds to convert.

parameter object

The optional parameter used to help with conversion.

Returns

DateTime

The converted DateTime in UTC.