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 net45, netstandard1.3, netstandard2.0
Inheritance
Object
ZonedClock
Implements
Inherited Members
Object.ToString()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.ReferenceEquals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
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 net45, netstandard1.3, 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. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | clock, zone or calendar is null |
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 net45, netstandard1.3, 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 net45, netstandard1.3, 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 net45, netstandard1.3, 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 net45, netstandard1.3, 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 net45, netstandard1.3, 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 net45, netstandard1.3, 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. |