Пример #1
0
 private Instant InstantFromDateTime(DateTime dateTime)
 {
     return(Instant.FromDateTimeOffset(new DateTimeOffset(DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified),
                                                          DefaultBias.ToTimeSpan())));
 }
 protected Instant InstantFromDateTime(DateTime dateTime, Func <DateTimeZone> zoneResolver = null)
 {
     return(dateTime.Kind == DateTimeKind.Utc
         ? Instant.FromDateTimeUtc(dateTime)
         : HasZoneInfo
             ? InstantFromLocalDateTime(LocalDateTime.FromDateTime(dateTime), zoneResolver)
             : Instant.FromDateTimeOffset(new DateTimeOffset(DateTime.SpecifyKind(dateTime, DateTimeKind.Unspecified), DefaultBias.ToTimeSpan())));
 }