コード例 #1
0
 public static void SetUTCTime(DateTime date, DateTime time)
 {
     if (date != null && time != null)
     {
         date.SetUTCHours(time.GetUTCHours());
         date.SetUTCMinutes(time.GetUTCMinutes());
         date.SetUTCSeconds(time.GetUTCSeconds());
         date.SetUTCMilliseconds(time.GetUTCMilliseconds());
     }
 }
コード例 #2
0
ファイル: DateTimeEx.cs プロジェクト: DeBiese/SparkleXrm
 public static string ToXrmStringUTC(DateTime date)
 {
     // Get a date string from the Date object
     //2011-04-20T14:00:00Z
     // NOTE: we assume that the local date is in fact converted to UTC already
     // This avoids any local browser timezone missmatches with the user settings timezone
     string month = DateTimeEx.PadNumber(date.GetUTCMonth() + 1, 2);
     string day = DateTimeEx.PadNumber(date.GetUTCDate(), 2);
     string hours = DateTimeEx.PadNumber(date.GetUTCHours(), 2);
     string mins = DateTimeEx.PadNumber(date.GetUTCMinutes(), 2);
     string secs = DateTimeEx.PadNumber(date.GetUTCSeconds(), 2);
     return String.Format("{0}-{1}-{2}T{3}:{4}:{5}Z", date.GetUTCFullYear(), month, day, hours, mins, secs);
 }
コード例 #3
0
        public static string ToXrmStringUTC(DateTime date)
        {
            // Get a date string from the Date object
            //2011-04-20T14:00:00Z
            // NOTE: we assume that the local date is in fact converted to UTC already
            // This avoids any local browser timezone missmatches with the user settings timezone
            string month = DateTimeEx.PadNumber(date.GetUTCMonth() + 1, 2);
            string day   = DateTimeEx.PadNumber(date.GetUTCDate(), 2);
            string hours = DateTimeEx.PadNumber(date.GetUTCHours(), 2);
            string mins  = DateTimeEx.PadNumber(date.GetUTCMinutes(), 2);
            string secs  = DateTimeEx.PadNumber(date.GetUTCSeconds(), 2);

            return(String.Format("{0}-{1}-{2}T{3}:{4}:{5}Z", date.GetUTCFullYear(), month, day, hours, mins, secs));
        }
コード例 #4
0
ファイル: DateTimeEx.cs プロジェクト: DeBiese/SparkleXrm
 public static void SetUTCTime(DateTime date, DateTime time)
 {
     if (date != null && time != null)
     {
         date.SetUTCHours(time.GetUTCHours());
         date.SetUTCMinutes(time.GetUTCMinutes());
         date.SetUTCSeconds(time.GetUTCSeconds());
         date.SetUTCMilliseconds(time.GetUTCMilliseconds());
     }
 }