Struct ZonedWeek
Represents a week with time zone.
public readonly struct ZonedWeek : IEquatable<ZonedWeek>, IComparable<ZonedWeek>, IComparable- Implements
- Inherited Members
Properties
Duration
Duration of this week.
public Duration Duration { get; }Property Value
End
End of this week.
public ZonedDateTime End { get; }Property Value
IsLocal
Checks whether or not the TimeZone is local.
public bool IsLocal { get; }Property Value
IsUtc
Checks whether or not the TimeZone is UTC.
public bool IsUtc { get; }Property Value
Start
Start of this week.
public ZonedDateTime Start { get; }Property Value
TimeZone
Time zone of this week.
public TimeZoneInfo TimeZone { get; }Property Value
WeekOfYear
Week of year component.
public int WeekOfYear { get; }Property Value
Year
Year component.
public int Year { get; }Property Value
Methods
Add(Period)
Creates a new ZonedWeek instance by adding value to this instance.
[Pure]
public ZonedWeek Add(Period value)Parameters
Returns
AddWeeks(int)
Creates a new ZonedWeek instance by adding provided number of weeks to this instance.
[Pure]
public ZonedWeek AddWeeks(int weeks)Parameters
- weeksint
- Number of weeks to add. 
Returns
CompareTo(ZonedWeek)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
[Pure]
public int CompareTo(ZonedWeek other)Parameters
- otherZonedWeek
- An object to compare with this instance. 
Returns
- int
- A value that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance precedes - otherin the sort order.- Zero - This instance occurs in the same position in the sort order as - other.- Greater than zero - This instance follows - otherin the sort order.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
[Pure]
public int CompareTo(object? obj)Parameters
- objobject
- An object to compare with this instance. 
Returns
- int
- A value that indicates the relative order of the objects being compared. The return value has these meanings: - Value - Meaning - Less than zero - This instance precedes - objin the sort order.- Zero - This instance occurs in the same position in the sort order as - obj.- Greater than zero - This instance follows - objin the sort order.
Exceptions
- ArgumentException
- objis not the same type as this instance.
Contains(ZonedDateTime)
Checks whether or not the provided dateTime belongs to this week.
[Pure]
public bool Contains(ZonedDateTime dateTime)Parameters
- dateTimeZonedDateTime
- Date time to check. 
Returns
- bool
- true when the provided - dateTimebelongs to this week, otherwise false.
Contains(ZonedDay)
Checks whether or not the provided day belongs to this week.
[Pure]
public bool Contains(ZonedDay day)Parameters
- dayZonedDay
- Day to check. 
Returns
- bool
- true when the provided - daybelongs to this week, otherwise false.
Create(ZonedDateTime, IsoDayOfWeek)
Creates a new ZonedWeek instance.
[Pure]
public static ZonedWeek Create(ZonedDateTime dateTime, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- dateTimeZonedDateTime
- Date time contained by the result. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Create(ZonedDay, IsoDayOfWeek)
Creates a new ZonedWeek instance.
[Pure]
public static ZonedWeek Create(ZonedDay day, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- dayZonedDay
- Day contained by the result. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Create(DateTime, TimeZoneInfo, IsoDayOfWeek)
Creates a new ZonedWeek instance.
[Pure]
public static ZonedWeek Create(DateTime dateTime, TimeZoneInfo timeZone, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- dateTimeDateTime
- Date time contained by the result. 
- timeZoneTimeZoneInfo
- Target time zone. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Create(int, int, TimeZoneInfo, IsoDayOfWeek)
Creates a new ZonedWeek instance.
[Pure]
public static ZonedWeek Create(int year, int weekOfYear, TimeZoneInfo timeZone, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- timeZoneTimeZoneInfo
- Target time zone. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Exceptions
- ArgumentOutOfRangeException
- When - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
CreateLocal(DateTime, IsoDayOfWeek)
[Pure]
public static ZonedWeek CreateLocal(DateTime localDateTime, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- localDateTimeDateTime
- Date time contained by the result. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
CreateLocal(int, int, IsoDayOfWeek)
[Pure]
public static ZonedWeek CreateLocal(int year, int weekOfYear, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Exceptions
- ArgumentOutOfRangeException
- When - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
CreateUtc(Timestamp, IsoDayOfWeek)
[Pure]
public static ZonedWeek CreateUtc(Timestamp timestamp, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- timestampTimestamp
- Timestamp contained by the result. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
CreateUtc(DateTime, IsoDayOfWeek)
[Pure]
public static ZonedWeek CreateUtc(DateTime utcDateTime, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- utcDateTimeDateTime
- Date time contained by the result. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
CreateUtc(int, int, IsoDayOfWeek)
[Pure]
public static ZonedWeek CreateUtc(int year, int weekOfYear, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
Exceptions
- ArgumentOutOfRangeException
- When - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
Equals(ZonedWeek)
Indicates whether the current object is equal to another object of the same type.
[Pure]
public bool Equals(ZonedWeek other)Parameters
- otherZonedWeek
- An object to compare with this object. 
Returns
Equals(object?)
Indicates whether this instance and a specified object are equal.
[Pure]
public override bool Equals(object? obj)Parameters
- objobject
- The object to compare with the current instance. 
Returns
- bool
- true if - objand this instance are the same type and represent the same value; otherwise, false.
GetAllDays()
Creates a new IEnumerable<T> instance that contains all days of this week in order.
[Pure]
public IEnumerable<ZonedDay> GetAllDays()Returns
- IEnumerable<ZonedDay>
- New IEnumerable<T> instance. 
GetDayOfWeek(IsoDayOfWeek)
Creates a new ZonedDay instance that represents the specified day of this week.
[Pure]
public ZonedDay GetDayOfWeek(IsoDayOfWeek day)Parameters
- dayIsoDayOfWeek
- Day of this week to get. 
Returns
GetFriday()
[Pure]
public ZonedDay GetFriday()Returns
GetGreedyPeriodOffset(ZonedWeek, PeriodUnits)
Creates a new Period instance by calculating a difference between this instance and
the start instance, where this instance is treated as the end of the range,
using the specified units.
[Pure]
public Period GetGreedyPeriodOffset(ZonedWeek start, PeriodUnits units)Parameters
- startZonedWeek
- Start week. 
- unitsPeriodUnits
- PeriodUnits to include in the calculated difference. 
Returns
Remarks
Greedy Period may contain components with negative values.
GetHashCode()
Returns the hash code for this instance.
[Pure]
public override int GetHashCode()Returns
- int
- A 32-bit signed integer that is the hash code for this instance. 
GetMonday()
[Pure]
public ZonedDay GetMonday()Returns
GetNext()
Creates a new ZonedWeek instance by calculating the next week.
[Pure]
public ZonedWeek GetNext()Returns
GetPeriodOffset(ZonedWeek, PeriodUnits)
Creates a new Period instance by calculating a difference between this instance and
the start instance, where this instance is treated as the end of the range,
using the specified units.
[Pure]
public Period GetPeriodOffset(ZonedWeek start, PeriodUnits units)Parameters
- startZonedWeek
- Start week. 
- unitsPeriodUnits
- PeriodUnits to include in the calculated difference. 
Returns
GetPrevious()
Creates a new ZonedWeek instance by calculating the previous week.
[Pure]
public ZonedWeek GetPrevious()Returns
GetSaturday()
[Pure]
public ZonedDay GetSaturday()Returns
GetSunday()
[Pure]
public ZonedDay GetSunday()Returns
GetThursday()
[Pure]
public ZonedDay GetThursday()Returns
GetTuesday()
[Pure]
public ZonedDay GetTuesday()Returns
GetWednesday()
[Pure]
public ZonedDay GetWednesday()Returns
GetYear()
Creates a new ZonedYear instance that contains this instance.
[Pure]
public ZonedYear GetYear()Returns
SetWeekOfYear(int)
Creates a new ZonedWeek instance by setting the WeekOfYear component in this instance.
[Pure]
public ZonedWeek SetWeekOfYear(int week)Parameters
- weekint
- Week of year to set. 
Returns
Exceptions
- ArgumentOutOfRangeException
- When - weekis not valid.
SetWeekStart(IsoDayOfWeek)
Creates a new ZonedWeek instance by setting new first day of the week in this instance.
[Pure]
public ZonedWeek SetWeekStart(IsoDayOfWeek weekStart)Parameters
- weekStartIsoDayOfWeek
- First day of the week to set. 
Returns
Exceptions
- ArgumentOutOfRangeException
- When - weekStartresults in the creation of an invalid week.
SetYear(int)
[Pure]
public ZonedWeek SetYear(int year)Parameters
- yearint
- Year to set. 
Returns
Remarks
Result may end up with modified components other than the year, if it lands in the range of invalid values of this instance's TimeZone.
Exceptions
- ArgumentOutOfRangeException
- When - yearis not valid.
Subtract(Period)
Creates a new ZonedWeek instance by subtracting value from this instance.
[Pure]
public ZonedWeek Subtract(Period value)Parameters
Returns
SubtractWeeks(int)
Creates a new ZonedWeek instance by subtracting provided number of weeks from this instance.
[Pure]
public ZonedWeek SubtractWeeks(int weeks)Parameters
- weeksint
- Number of weeks to subtract. 
Returns
ToBounds()
[Pure]
public Bounds<ZonedDateTime> ToBounds()Returns
- Bounds<ZonedDateTime>
- New Bounds<T> instance. 
ToCheckedBounds()
Creates a new BoundsRange<T> instance from this instance's Start and End including any overlapping ambiguity.
[Pure]
public BoundsRange<ZonedDateTime> ToCheckedBounds()Returns
- BoundsRange<ZonedDateTime>
- New BoundsRange<T> instance. 
ToLocalTimeZone()
[Pure]
public ZonedWeek ToLocalTimeZone()Returns
ToString()
Returns a string representation of this ZonedWeek instance.
[Pure]
public override string ToString()Returns
- string
- String representation. 
ToTimeZone(TimeZoneInfo)
Creates a new ZonedWeek in the targetTimeZone from this instance.
[Pure]
public ZonedWeek ToTimeZone(TimeZoneInfo targetTimeZone)Parameters
- targetTimeZoneTimeZoneInfo
- Target time zone. 
Returns
ToUtcTimeZone()
[Pure]
public ZonedWeek ToUtcTimeZone()Returns
TryCreate(int, int, TimeZoneInfo, IsoDayOfWeek)
Attempts to create a new ZonedWeek instance.
[Pure]
public static ZonedWeek? TryCreate(int year, int weekOfYear, TimeZoneInfo timeZone, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- timeZoneTimeZoneInfo
- Target time zone. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
- ZonedWeek?
- New ZonedWeek instance or null when - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
TryCreateLocal(int, int, IsoDayOfWeek)
[Pure]
public static ZonedWeek? TryCreateLocal(int year, int weekOfYear, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
- ZonedWeek?
- New ZonedWeek instance or null when - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
TryCreateUtc(int, int, IsoDayOfWeek)
[Pure]
public static ZonedWeek? TryCreateUtc(int year, int weekOfYear, IsoDayOfWeek weekStart = IsoDayOfWeek.Monday)Parameters
- yearint
- Year component of the week. 
- weekOfYearint
- Number of the week in year. 
- weekStartIsoDayOfWeek
- First day of the week. Equal to Monday by default. 
Returns
- ZonedWeek?
- New ZonedWeek instance or null when - weekOfYearis less than 1 or greater than the maximum week number in the specified- year.
TrySetWeekOfYear(int)
Attempts to create a new ZonedWeek instance by setting the WeekOfYear component in this instance.
[Pure]
public ZonedWeek? TrySetWeekOfYear(int week)Parameters
- weekint
- Week of year to set. 
Returns
TrySetWeekStart(IsoDayOfWeek)
Attempts to create a new ZonedWeek instance by setting new first day of the week in this instance.
[Pure]
public ZonedWeek? TrySetWeekStart(IsoDayOfWeek weekStart)Parameters
- weekStartIsoDayOfWeek
- First day of the week to set. 
Returns
- ZonedWeek?
- New ZonedWeek instance or null when - weekStartresults in the creation of an invalid week.
Operators
operator +(ZonedWeek, Period)
Creates a new ZonedWeek instance by adding a and b together.
[Pure]
public static ZonedWeek operator +(ZonedWeek a, Period b)Parameters
Returns
operator ==(ZonedWeek, ZonedWeek)
Checks if a is equal to b.
[Pure]
public static bool operator ==(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when operands are equal, otherwise false. 
operator >(ZonedWeek, ZonedWeek)
Checks if a is greater than b.
[Pure]
public static bool operator >(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when - ais greater than- b, otherwise false.
operator >=(ZonedWeek, ZonedWeek)
Checks if a is greater than or equal to b.
[Pure]
public static bool operator >=(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when - ais greater than or equal to- b, otherwise false.
operator !=(ZonedWeek, ZonedWeek)
Checks if a is not equal to b.
[Pure]
public static bool operator !=(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when operands are not equal, otherwise false. 
operator <(ZonedWeek, ZonedWeek)
Checks if a is less than b.
[Pure]
public static bool operator <(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when - ais less than- b, otherwise false.
operator <=(ZonedWeek, ZonedWeek)
Checks if a is less than or equal to b.
[Pure]
public static bool operator <=(ZonedWeek a, ZonedWeek b)Parameters
Returns
- bool
- true when - ais less than or equal to- b, otherwise false.
operator -(ZonedWeek, Period)
Creates a new ZonedWeek instance by subtracting b from a.
[Pure]
public static ZonedWeek operator -(ZonedWeek a, Period b)