CalendarDateTime Struct

A date or a date and time of an iCalendar object: a date (VALUE=DATE), a time in UTC (Z), a local time in a time zone (TZID), or a floating time.

public readonly struct CalendarDateTime : IEquatable<CalendarDateTime>
Implements

Constructors

NameDescription
CalendarDateTime(DateTime, string?, bool)Creates a date and time.

CalendarDateTime(DateTime, string?, bool)

CalendarDateTime.cs

Creates a date and time.

public CalendarDateTime(DateTime value, string? timeZoneId = null, bool isDate = false)

Parameters

value DateTime
The value: in UTC when its kind is DateTimeKind.Utc, a local time otherwise.
timeZoneId string?
The identifier of the time zone of a local time (TZID), or null for a time in UTC or a floating time.
isDate bool
Whether the value is a date, without a time.

Properties

NameDescription
IsDateGets whether the value is a date, without a time (an all-day event).
IsUtcGets whether the value is in UTC.
TimeZoneIdGets the identifier of the time zone of a local time, or null.
ValueGets the value.

Gets whether the value is a date, without a time (an all-day event).

public bool IsDate { get; }

Property value

bool

Gets whether the value is in UTC.

public bool IsUtc { get; }

Property value

bool

Gets the identifier of the time zone of a local time, or null.

public string? TimeZoneId { get; }

Property value

string?

Gets the value.

public DateTime Value { get; }

Property value

DateTime

Methods

NameDescription
Equals(CalendarDateTime)
Equals(object)
FromDate(DateOnly)Creates a date.
FromUtc(DateTime)Creates a time in UTC.
GetHashCode()
Parse(ContentLine)Reads the value of a property: its value, and its parameters VALUE and TZID.
Parse(string, string?)Reads a date or a date and time.
ToString()Returns the value as it is written in a property.
ToUtc(VCalendar?)Returns the value in UTC: a time in UTC as it is, a local time with the definition of its time zone in the calendar (VTIMEZONE). A date is midnight in UTC.

Equals overloads

Equals(CalendarDateTime)

public bool Equals(CalendarDateTime other)
Parameters
other CalendarDateTime
Returns

bool

No documentation is available.

Equals(object)

public override bool Equals(object obj)
Parameters
obj object
Returns

bool

No documentation is available.

FromDate(DateOnly)

CalendarDateTime.cs

Creates a date.

public static CalendarDateTime FromDate(DateOnly date)

Parameters

date DateOnly
The date.

Returns

CalendarDateTime The date.

FromUtc(DateTime)

CalendarDateTime.cs

Creates a time in UTC.

public static CalendarDateTime FromUtc(DateTime value)

Parameters

value DateTime
The time; a time that is not in UTC is converted.

Returns

CalendarDateTime The time.

GetHashCode()

public override int GetHashCode()

Returns

int

No documentation is available.

Parse overloads

Parse(ContentLine)

CalendarDateTime.cs

Reads the value of a property: its value, and its parameters VALUE and TZID.

public static CalendarDateTime? Parse(ContentLine line)
Parameters
line ContentLine
The property.
Returns

CalendarDateTime? The value, or null when it is not a date or a date and time.

Parse(string, string?)

CalendarDateTime.cs

Reads a date or a date and time.

public static CalendarDateTime? Parse(string value, string? timeZoneId = null)
Parameters
value string
The value, such as 20260115, 20260115T090000Z or 20260115T090000.
timeZoneId string?
The identifier of the time zone of a local time.
Returns

CalendarDateTime? The value, or null when it is not a date or a date and time.

Returns the value as it is written in a property.

public override string ToString()

Returns

string The value: 20260115, 20260115T090000Z or 20260115T090000.

ToUtc(VCalendar?)

CalendarDateTime.cs

Returns the value in UTC: a time in UTC as it is, a local time with the definition of its time zone in the calendar (VTIMEZONE). A date is midnight in UTC.

public DateTime? ToUtc(VCalendar? calendar)

Parameters

calendar VCalendar?
The calendar that defines the time zones, or null.

Returns

DateTime? The time in UTC, or null for a floating time or a time zone the calendar does not define.

Operators

NameDescription
operator ==(CalendarDateTime, CalendarDateTime)
operator !=(CalendarDateTime, CalendarDateTime)

operator ==(CalendarDateTime, CalendarDateTime)

public static bool operator ==(CalendarDateTime left, CalendarDateTime right)

Parameters

left CalendarDateTime
right CalendarDateTime

Returns

bool

No documentation is available.

operator !=(CalendarDateTime, CalendarDateTime)

public static bool operator !=(CalendarDateTime left, CalendarDateTime right)

Parameters

left CalendarDateTime
right CalendarDateTime

Returns

bool

No documentation is available.