• DR-IT Software
  • Products
  • Documentation
  • Product page
  • Examples
  • API reference
  • Support
Show / Hide Table of Contents

Class ICalDateTime

An iCalendar date-time value (RFC 5545 §3.3.5). Can be UTC, local (with a TZID parameter), or date-only. Immutable after construction.

Inheritance
object
ICalDateTime
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
Namespace: DRIT.Mail.Rfc.ICal
Assembly: DRIT.Mail.dll
Syntax
public sealed class ICalDateTime

Constructors

View Source

ICalDateTime(DateTime, bool, bool, string?)

Initializes a new instance of the ICalDateTime class.

Declaration
public ICalDateTime(DateTime value, bool isUtc, bool isDateOnly, string? timeZoneId)
Parameters
Type Name Description
DateTime value

The date-time value.

bool isUtc

true if the value is in UTC.

bool isDateOnly

true if the value is a date with no time component.

string timeZoneId

The TZID parameter value, or null for UTC/floating.

Properties

View Source

IsDateOnly

Gets a value indicating whether the value is a date with no time component (VALUE=DATE).

Declaration
public bool IsDateOnly { get; }
Property Value
Type Description
bool
View Source

IsUtc

Gets a value indicating whether the date-time is in UTC (has a trailing Z).

Declaration
public bool IsUtc { get; }
Property Value
Type Description
bool
View Source

TimeZoneId

Gets the TZID parameter value, or null if the date-time is UTC or floating.

Declaration
public string? TimeZoneId { get; }
Property Value
Type Description
string
View Source

Value

Gets the date-time value.

Declaration
public DateTime Value { get; }
Property Value
Type Description
DateTime

Methods

View Source

AsDateTimeOffset(TimeZoneInfo?)

Converts this date-time to a DateTimeOffset. If this date-time is UTC, the offset is Zero. If a tz is provided and has a matching TimeZoneId, that timezone's offset is used. Otherwise the local offset is assumed.

Declaration
public DateTimeOffset AsDateTimeOffset(TimeZoneInfo? tz = null)
Parameters
Type Name Description
TimeZoneInfo tz

Specifies the tz value.

Returns
Type Description
DateTimeOffset
View Source

Parse(string)

Parses an iCalendar date-time or date value (RFC 5545 §3.3.5). Supports: YYYYMMDDTHHMMSSZ (UTC), YYYYMMDDTHHMMSS (local), and YYYYMMDD (date only). The TZID is set separately from the parsing of the property's TZID parameter; this method only parses the raw value text.

Declaration
public static ICalDateTime Parse(string text)
Parameters
Type Name Description
string text

Specifies the text value.

Returns
Type Description
ICalDateTime
View Source

ToString()

Formats this date-time for iCalendar serialization. Date-only produces YYYYMMDD; UTC produces YYYYMMDDTHHMMSSZ; local produces YYYYMMDDTHHMMSS.

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
object.ToString()
  • View Source
Back to top

DR-IT Software documentation

DR-IT Software · Products · Documentation index · Product page · Downloads · Support · Licensing

Generated by DocFX