/// <summary>Creates an <c>XMPDateTime</c>-object from initial values.</summary> /// <param name="year">years</param> /// <param name="month"> /// months from 1 to 12<br /> /// <em>Note:</em> Remember that the month in /// <see cref="Sharpen.Calendar"/> /// is defined from 0 to 11. /// </param> /// <param name="day">days</param> /// <returns>Returns an <c>XMPDateTime</c>-object.</returns> public static IXmpDateTime Create(int year, int month, int day) { IXmpDateTime dt = new XmpDateTime(); dt.Year = year; dt.Month = month; dt.Day = day; return(dt); }
/// <summary>Make sure a time is UTC.</summary> /// <remarks> /// Make sure a time is UTC. If the time zone is not UTC, the time is /// adjusted and the time zone set to be UTC. /// </remarks> /// <param name="dateTime"> /// the <c>XMPDateTime</c> variable containing the time to /// be modified. /// </param> /// <returns>Returns an updated <c>XMPDateTime</c>-object.</returns> public static IXmpDateTime ConvertToUtcTime(IXmpDateTime dateTime) { var timeInMillis = dateTime.Calendar.GetTimeInMillis(); var cal = new GregorianCalendar(TimeZoneInfo.Utc); cal.SetGregorianChange(XmpDateTime.UnixTimeToDateTime(long.MinValue)); cal.SetTimeInMillis(timeInMillis); return(new XmpDateTime(cal)); }
/// <summary>Creates an <c>XMPDateTime</c>-object from initial values.</summary> /// <param name="year">years</param> /// <param name="month"> /// months from 1 to 12<br /> /// <em>Note:</em> Remember that the month in /// <see cref="Sharpen.Calendar"/> /// is defined from 0 to 11. /// </param> /// <param name="day">days</param> /// <param name="hour">hours</param> /// <param name="minute">minutes</param> /// <param name="second">seconds</param> /// <param name="nanoSecond">nanoseconds</param> /// <returns>Returns an <c>XMPDateTime</c>-object.</returns> public static IXmpDateTime Create(int year, int month, int day, int hour, int minute, int second, int nanoSecond) { IXmpDateTime dt = new XmpDateTime(); dt.Year = year; dt.Month = month; dt.Day = day; dt.Hour = hour; dt.Minute = minute; dt.Second = second; dt.Nanosecond = nanoSecond; return(dt); }