示例#1
0
        //-----------------------------------------------------------------------
        /// <summary>
        /// Creates a transition instance for the specified year.
        /// <para>
        /// Calculations are performed using the ISO-8601 chronology.
        ///
        /// </para>
        /// </summary>
        /// <param name="year">  the year to create a transition for, not null </param>
        /// <returns> the transition instance, not null </returns>
        public ZoneOffsetTransition CreateTransition(int year)
        {
            LocalDate date;

            if (Dom < 0)
            {
                date = LocalDate.Of(year, Month_Renamed, Month_Renamed.length(IsoChronology.INSTANCE.IsLeapYear(year)) + 1 + Dom);
                if (Dow != null)
                {
                    date = date.With(previousOrSame(Dow));
                }
            }
            else
            {
                date = LocalDate.Of(year, Month_Renamed, Dom);
                if (Dow != null)
                {
                    date = date.With(nextOrSame(Dow));
                }
            }
            if (TimeEndOfDay)
            {
                date = date.PlusDays(1);
            }
            LocalDateTime localDT    = LocalDateTime.Of(date, Time);
            LocalDateTime transition = TimeDefinition_Renamed.createDateTime(localDT, StandardOffset_Renamed, OffsetBefore_Renamed);

            return(new ZoneOffsetTransition(transition, OffsetBefore_Renamed, OffsetAfter_Renamed));
        }
示例#2
0
        /// <summary>
        /// Converts this {@code Timestamp} object to a {@code LocalDateTime}.
        /// <para>
        /// The conversion creates a {@code LocalDateTime} that represents the
        /// same year, month, day of month, hours, minutes, seconds and nanos
        /// date-time value as this {@code Timestamp} in the local time zone.
        ///
        /// </para>
        /// </summary>
        /// <returns> a {@code LocalDateTime} object representing the same date-time value
        /// @since 1.8 </returns>
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("deprecation") public java.time.LocalDateTime toLocalDateTime()
        public virtual LocalDateTime ToLocalDateTime()
        {
            return(LocalDateTime.Of(Year + 1900, Month + 1, Date, Hours, Minutes, Seconds, Nanos));
        }