/// <summary> /// Initializes a new instance of the <see cref="ZonedDateTime"/> struct. /// </summary> /// <param name="instant">The instant.</param> /// <param name="zone">The time zone.</param> /// <param name="calendar">The calendar system.</param> /// <exception cref="ArgumentNullException"><paramref name="zone"/> or <paramref name="calendar"/> is null.</exception> public ZonedDateTime(Instant instant, DateTimeZone zone, CalendarSystem calendar) { Preconditions.CheckNotNull(zone, "zone"); Preconditions.CheckNotNull(calendar, "calendar"); offset = zone.GetUtcOffset(instant); localDateTime = new LocalDateTime(instant.Plus(offset), calendar); this.zone = zone; }
/// <summary> /// Add DateTimeSpan /// </summary> /// <param name="i"></param> /// <param name="ts"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusTimeSpan(this Instant i, DateTimeSpan ts) { return(i.Plus(ts.AsDuration())); }
/// <summary> /// Add days /// </summary> /// <param name="i"></param> /// <param name="days"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusDays(this Instant i, double days) { return(i.Plus(days.AsDurationOfDays())); }
/// <summary> /// Add hours /// </summary> /// <param name="i"></param> /// <param name="hours"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusHours(this Instant i, double hours) { return(i.Plus(hours.AsDurationOfHours())); }
/// <summary> /// Add Minutes /// </summary> /// <param name="i"></param> /// <param name="minutes"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusMinutes(this Instant i, double minutes) { return(i.Plus(minutes.AsDurationOfMinutes())); }
/// <summary> /// Add seconds /// </summary> /// <param name="i"></param> /// <param name="seconds"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusSeconds(this Instant i, double seconds) { return(i.Plus(seconds.AsDurationOfSeconds())); }
/// <summary> /// Add milliseconds /// </summary> /// <param name="i"></param> /// <param name="milliseconds"></param> /// <returns></returns> /// <exception cref="ArgumentNullException"></exception> public static Instant PlusMilliseconds(this Instant i, double milliseconds) { return(i.Plus(milliseconds.AsDurationOfMilliseconds())); }