Class ZonedClock
A clock with an associated time zone and calendar. This is effectively a convenience
class decorating an IClock.
Since 1.4.x
Availability netstandard2.0
Inheritance
Object
ZonedClock
Implements
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: NodaTime
Assembly: NodaTime.dll
Syntax
public sealed class ZonedClock : IClock
Constructors
ZonedClock(IClock, DateTimeZone, CalendarSystem)
Creates a new ZonedClock with the given clock, time zone and calendar system.
Since 1.4.x
Availability netstandard2.0
Declaration
public ZonedClock(IClock clock, DateTimeZone zone, CalendarSystem calendar)
Parameters
Type | Name | Description |
---|---|---|
IClock | clock | Clock to use to obtain instants. |
DateTimeZone | zone | Time zone to adjust instants into. |
CalendarSystem | calendar | Calendar system to use. |
Properties
Calendar
Gets the calendar system used when converting the current instant into a calendar-sensitive value.
Since 3.0.x
Availability netstandard2.0
Declaration
public CalendarSystem Calendar { get; }
Property Value
Type | Description |
---|---|
CalendarSystem | The calendar system associated with this zoned clock. |
Clock
Gets the clock used to provide the current instant.
Since 3.0.x
Availability netstandard2.0
Declaration
public IClock Clock { get; }
Property Value
Type | Description |
---|---|
IClock | The clock associated with this zoned clock. |
Zone
Gets the time zone used when converting the current instant into a zone-sensitive value.
Since 3.0.x
Availability netstandard2.0
Declaration
public DateTimeZone Zone { get; }
Property Value
Type | Description |
---|---|
DateTimeZone | The time zone associated with this zoned clock. |
Methods
GetCurrentDate()
Returns the local date of the current instant provided by the underlying clock, adjusted
to the time zone of this object.
Since 1.4.x
Availability netstandard2.0
Declaration
public LocalDate GetCurrentDate()
Returns
Type | Description |
---|---|
LocalDate | The local date of the current instant provided by the underlying clock, adjusted to the time zone of this object. |
GetCurrentInstant()
Returns the current instant provided by the underlying clock.
Since 1.4.x
Availability netstandard2.0
Declaration
public Instant GetCurrentInstant()
Returns
Type | Description |
---|---|
Instant | The current instant provided by the underlying clock. |
GetCurrentLocalDateTime()
Returns the local date/time of the current instant provided by the underlying clock, adjusted
to the time zone of this object.
Since 1.4.x
Availability netstandard2.0
Declaration
public LocalDateTime GetCurrentLocalDateTime()
Returns
Type | Description |
---|---|
LocalDateTime | The local date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object. |
GetCurrentOffsetDateTime()
Returns the offset date/time of the current instant provided by the underlying clock, adjusted
to the time zone of this object.
Since 1.4.x
Availability netstandard2.0
Declaration
public OffsetDateTime GetCurrentOffsetDateTime()
Returns
Type | Description |
---|---|
OffsetDateTime | The offset date/time of the current instant provided by the underlying clock, adjusted to the time zone of this object. |
GetCurrentTimeOfDay()
Returns the local time of the current instant provided by the underlying clock, adjusted
to the time zone of this object.
Since 1.4.x
Availability netstandard2.0
Declaration
public LocalTime GetCurrentTimeOfDay()
Returns
Type | Description |
---|---|
LocalTime | The local time of the current instant provided by the underlying clock, adjusted to the time zone of this object. |
GetCurrentZonedDateTime()
Returns the current instant provided by the underlying clock, adjusted
to the time zone of this object.
Since 1.4.x
Availability netstandard2.0
Declaration
public ZonedDateTime GetCurrentZonedDateTime()
Returns
Type | Description |
---|---|
ZonedDateTime | The current instant provided by the underlying clock, adjusted to the time zone of this object. |