/// <summary> /// Gets the UTC time from local time. /// </summary> /// <param name="dateTime">The date time.</param> /// <returns></returns> public static DateTime GetUTCTimeFromLocalTime(DateTime dateTime) { IContextService context = ApplicationContext.Current.Services.Get <IContextService>(true); if (context.HasContext("TimeZone")) { Sage.Platform.TimeZone timeZone = (Sage.Platform.TimeZone)context.GetContext("TimeZone"); return(timeZone.LocalDateTimeToUTCTime(dateTime)); } return(dateTime); }