Table of Contents

Class DateTimeWithTimeZone

Namespace
Geotab.Checkmate.ObjectModel
Assembly
Geotab.Checkmate.ObjectModel.dll

An object with DateTime and TimeZoneInfo.

[Obsolete("Use native DateTimeOffset instead", false)]
public class DateTimeWithTimeZone
Inheritance
DateTimeWithTimeZone
Inherited Members

Constructors

DateTimeWithTimeZone(in DateTime, TimeZoneInfo)

Initializes a new instance of the DateTimeWithTimeZone class.

public DateTimeWithTimeZone(in DateTime localDateTime, TimeZoneInfo timeZone)

Parameters

localDateTime DateTime

The local date time.

timeZone TimeZoneInfo

The Timezone.

Properties

LocalDateTime

Gets the local. DateTime

public DateTime LocalDateTime { get; }

Property Value

DateTime

The local. DateTime

TimeZone

Gets the TimeZoneInfo.

public TimeZoneInfo TimeZone { get; }

Property Value

TimeZoneInfo

TimeZoneInfo

Methods

Equals(object?)

Determines whether the specified object, is equal to this instance.

public override bool Equals(object? obj)

Parameters

obj object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

FromUtcDateTime(in DateTime, TimeZoneInfo)

Converts the provided UTC DateTime to a time in the provided TimeZoneInfo.

public static DateTime FromUtcDateTime(in DateTime utcDateTime, TimeZoneInfo timeZone)

Parameters

utcDateTime DateTime

The UTC date time.

timeZone TimeZoneInfo

The Timezone.

Returns

DateTime

DateTime

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

Operators

implicit operator DateTimeOffset(DateTimeWithTimeZone)

Implicit converter to convert DateTimeWithTimeZone to DateTimeOffset. Created for backwards compatibility.

public static implicit operator DateTimeOffset(DateTimeWithTimeZone zonedTime)

Parameters

zonedTime DateTimeWithTimeZone

DateTimeWithTimeZone

Returns

DateTimeOffset

DateTimeOffset equivalent of the provided DateTimeWithTimeZone

implicit operator DateTimeWithTimeZone(in DateTimeOffset)

Implicit converter to convert DateTimeOffset to DateTimeWithTimeZone. Created for backwards compatibility. The converter converts the DateTimeOffset value into a UTC time, meaning the returned DateTimeWithTimeZone will be in UTC time.

public static implicit operator DateTimeWithTimeZone(in DateTimeOffset zonedTime)

Parameters

zonedTime DateTimeOffset

DateTimeOffset

Returns

DateTimeWithTimeZone

DateTimeWithTimeZone equivalent of the provided DateTimeOffset