ToDateTime() public static method

A method that creates the T:System.DateTime from the parameters.
public static ToDateTime ( int year, int month, int day, int hour, int minute, int second, int milliseconds ) : System.DateTime
year int An integer that gives the year ///
month int An integer that specifies the month. ///
day int An integer that specifies the day. ///
hour int An integer that specifies the hour. ///
minute int An integer that specifies the minute. ///
second int An integer that gives the second. ///
milliseconds int An integer that gives the /// milliseconds. ///
return System.DateTime
コード例 #1
0
        /// <summary>Returns a <see cref="T:System.DateTime" /> that is set to the specified date and time in the specified era.</summary>
        /// <returns>The <see cref="T:System.DateTime" /> that is set to the specified date and time in the current era.</returns>
        /// <param name="year">An integer that represents the year. </param>
        /// <param name="month">An integer from 1 to 12 that represents the month. </param>
        /// <param name="day">An integer from 1 to 31 that represents the day. </param>
        /// <param name="hour">An integer from 0 to 23 that represents the hour. </param>
        /// <param name="minute">An integer from 0 to 59 that represents the minute. </param>
        /// <param name="second">An integer from 0 to 59 that represents the second. </param>
        /// <param name="millisecond">An integer from 0 to 999 that represents the millisecond. </param>
        /// <param name="era">An integer that represents the era. </param>
        /// <exception cref="T:System.ArgumentOutOfRangeException">
        ///   <paramref name="year" /> is outside the range supported by the calendar.-or- <paramref name="month" /> is outside the range supported by the calendar.-or- <paramref name="day" /> is outside the range supported by the calendar.-or- <paramref name="hour" /> is less than zero or greater than 23.-or- <paramref name="minute" /> is less than zero or greater than 59.-or- <paramref name="second" /> is less than zero or greater than 59.-or- <paramref name="millisecond" /> is less than zero or greater than 999.-or- <paramref name="era" /> is outside the range supported by the calendar. </exception>
        public override DateTime ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
        {
            int year2 = this.M_CheckYMDEG(year, month, day, ref era);

            base.M_CheckHMSM(hour, minute, second, millisecond);
            return(CCGregorianCalendar.ToDateTime(year2, month, day, hour, minute, second, millisecond));
        }
コード例 #2
0
 /// <summary>
 /// Overridden. Creates the
 /// <see cref="T:System.DateTime"/> from the parameters.
 /// </summary>
 /// <param name="year">An integer that gives the year in the
 /// <paramref name="era"/>.
 /// </param>
 /// <param name="month">An integer that specifies the month.
 /// </param>
 /// <param name="day">An integer that specifies the day.
 /// </param>
 /// <param name="hour">An integer that specifies the hour.
 /// </param>
 /// <param name="minute">An integer that specifies the minute.
 /// </param>
 /// <param name="second">An integer that gives the second.
 /// </param>
 /// <param name="milliseconds">An integer that gives the
 /// milliseconds.
 /// </param>
 /// <param name="era">An integer that specifies the era.
 /// </param>
 /// <returns>
 /// <see cref="T:system.DateTime"/> representig the date and time.
 /// </returns>
 /// <exception cref="T:System.ArgumentOutOfRangeException">
 /// The exception is thrown, if at least one of the parameters
 /// is out of range.
 /// </exception>
 public override DateTime ToDateTime(int year, int month, int day,
                                     int hour, int minute, int second, int milliseconds,
                                     int era)
 {
     M_CheckYMDE(year, month, day, ref era);
     M_CheckHMSM(hour, minute, second, milliseconds);
     return(CCGregorianCalendar.ToDateTime(
                year, month, day,
                hour, minute, second, milliseconds));
 }
コード例 #3
0
	/// <summary>
	/// Overridden. Creates the
	/// <see cref="T:System.DateTime"/> from the parameters.
	/// </summary>
	/// <param name="year">An integer that gives the year in the
	/// <paramref name="era"/>.
	/// </param>
	/// <param name="month">An integer that specifies the month.
	/// </param>
	/// <param name="day">An integer that specifies the day.
	/// </param>
	/// <param name="hour">An integer that specifies the hour.
	/// </param>
	/// <param name="minute">An integer that specifies the minute.
	/// </param>
	/// <param name="second">An integer that gives the second.
	/// </param>
	/// <param name="milliseconds">An integer that gives the
	/// milliseconds.
	/// </param>
	/// <param name="era">An integer that specifies the era.
	/// </param>
	/// <returns>A
	/// <see cref="T:system.DateTime"/> representig the date and time.
	/// </returns>
	/// <exception cref="T:System.ArgumentOutOfRangeException">
	/// The exception is thrown, if at least one of the parameters
	/// is out of range.
	/// </exception>
	public override DateTime ToDateTime(int year, int month, int day,
		int hour, int minute, int second, int millisecond,
		int era)
	{
		int gregorianYear = M_CheckYMDEG(year, month, day, ref era);
		M_CheckHMSM(hour, minute, second, millisecond);
		return CCGregorianCalendar.ToDateTime(
			gregorianYear, month, day,
			hour, minute, second, millisecond);
	}