/// <summary> /// Sets the local time zone without touching any other Any existing time zone value is replaced, /// the other date/time fields are not adjusted in any way. /// </summary> /// <param name="dateTime">the <code>XMPDateTime</code> variable containing the value to be modified. /// </param> /// <returns>Returns an updated <code>XMPDateTime</code>-object.</returns> public static XMPDateTime SetLocalTimeZone(XMPDateTime dateTime) { XMPCalendar cal = dateTime.GetCalendar(); cal.SetTimeZone(TimeZone.CurrentTimeZone); return(new XMPDateTimeImpl(cal)); }
/// <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 <code>XMPDateTime</code> variable containing the time to /// be modified. /// </param> /// <returns>Returns an updated <code>XMPDateTime</code>-object.</returns> public static XMPDateTime ConvertToUTCTime(XMPDateTime dateTime) { long timeInMillis = dateTime.GetCalendar().GetTimeInMillis(); XMPCalendar cal = new XMPCalendar(); cal.SetTimeInMillis(timeInMillis); return(new XMPDateTimeImpl(cal)); }
/// <summary>Make sure a time is local.</summary> /// <remarks> /// Make sure a time is local. If the time zone is not the local zone, the time is adjusted and /// the time zone set to be local. /// </remarks> /// <param name="dateTime">the <code>XMPDateTime</code> variable containing the time to be modified. /// </param> /// <returns>Returns an updated <code>XMPDateTime</code>-object.</returns> public static XMPDateTime ConvertToLocalTime(XMPDateTime dateTime) { long timeInMillis = dateTime.GetCalendar().GetTimeInMillis(); // has automatically local timezone XMPCalendar cal = new XMPCalendar(); cal.SetTimeInMillis(timeInMillis); return(new XMPDateTimeImpl(cal)); }
// EMPTY /// <summary>Creates an <code>XMPDateTime</code> from a <code>Calendar</code>-object. /// </summary> /// <param name="calendar">a <code>Calendar</code>-object.</param> /// <returns>An <code>XMPDateTime</code>-object.</returns> public static XMPDateTime CreateFromCalendar(XMPCalendar calendar) { return(new XMPDateTimeImpl(calendar)); }