/// <summary> /// Initializes a new instance of <see cref="LocalDateTime"/> from given <see cref="System.DateTime"/> value. /// </summary> /// /// <remarks> /// The value of <see cref="DateTime.Kind"/> has no effect. Date and time component values will be used without any /// explicit conversions (i.e. we treat <see cref="DateTime.Kind"/> as if <see cref="DateTimeKind.Local"/>). /// </remarks> /// <param name="dateTime"></param> public LocalDateTime(DateTime dateTime) : this(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, TemporalHelpers.ExtractNanosecondFromTicks(dateTime.Ticks)) { }
/// <summary> /// Initializes a new instance of <see cref="OffsetTime"/> from given <see cref="TimeSpan"/> value /// </summary> /// <param name="time"></param> /// <param name="offsetSeconds"></param> private OffsetTime(TimeSpan time, int offsetSeconds) : this(time.Hours, time.Minutes, time.Seconds, TemporalHelpers.ExtractNanosecondFromTicks(time.Ticks), offsetSeconds) { }
/// <summary> /// Initializes a new instance of <see cref="ZonedDateTime"/> from given <see cref="DateTime"/> value. /// </summary> /// <param name="dateTime"></param> /// <param name="zoneId"></param> public ZonedDateTime(DateTime dateTime, string zoneId) : this(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, TemporalHelpers.ExtractNanosecondFromTicks(dateTime.Ticks), Zone.Of(zoneId)) { }
/// <summary> /// Initializes a new instance of <see cref="LocalTime"/> from given <see cref="TimeSpan"/> value /// </summary> /// <param name="time"></param> public LocalTime(TimeSpan time) : this(time.Hours, time.Minutes, time.Seconds, TemporalHelpers.ExtractNanosecondFromTicks(time.Ticks)) { }
/// <summary> /// Initializes a new instance of <see cref="ZonedDateTime"/> from given <see cref="DateTime"/> value. /// </summary> /// <param name="dateTime"></param> /// <param name="offsetSeconds"></param> public ZonedDateTime(DateTime dateTime, int offsetSeconds) : this(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, dateTime.Second, TemporalHelpers.ExtractNanosecondFromTicks(dateTime.Ticks), Zone.Of(offsetSeconds)) { }