/// <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();
     Sharpen.GregorianCalendar cal = new Sharpen.GregorianCalendar(Utc);
     cal.SetGregorianChange(Sharpen.Extensions.CreateDate(long.MinValue));
     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
     Sharpen.GregorianCalendar cal = new Sharpen.GregorianCalendar();
     cal.SetTimeInMillis(timeInMillis);
     return new XMPDateTimeImpl(cal);
 }
Exemple #3
0
        /// <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
            Sharpen.GregorianCalendar cal = new Sharpen.GregorianCalendar();
            cal.SetTimeInMillis(timeInMillis);
            return(new XMPDateTimeImpl(cal));
        }
Exemple #4
0
        /// <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();

            Sharpen.GregorianCalendar cal = new Sharpen.GregorianCalendar(Utc);
            cal.SetGregorianChange(Sharpen.Extensions.CreateDate(long.MinValue));
            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 <c>XMPDateTime</c> variable containing the time to be modified.</param>
 /// <returns>Returns an updated <c>XMPDateTime</c>-object.</returns>
 public static IXmpDateTime ConvertToLocalTime(IXmpDateTime dateTime)
 {
     var timeInMillis = dateTime.Calendar.GetTimeInMillis();
     // has automatically local timezone
     var cal = new GregorianCalendar();
     cal.SetTimeInMillis(timeInMillis);
     return new XmpDateTime(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 <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);
 }