/// <summary>
        /// 本区区时时间转换为格林威治区时时间
        /// </summary>
        /// <param name="localTime">本区区时时间</param>
        /// <returns>格林威治区时时间</returns>
        private static DateTime LocalTimeToGreenwishTime(DateTime localTime)
        {
            TimeZone localTimeZone = TimeZone.CurrentTimeZone;
            TimeSpan timeSpan = localTimeZone.GetUtcOffset(localTime);
            DateTime greenwishTime = localTime - timeSpan;
            return greenwishTime;
        }

        /// <summary>
        /// 格林威治区时时间转换为本区区时时间
        /// </summary>
        /// <param name="greenwishTime">格林威治区时时间</param>
        /// <returns>本区区时时间</returns>
        private static DateTime GreenwishTimeToLocalTime(DateTime greenwishTime)
        {
            TimeZone localTimeZone = System.TimeZone.CurrentTimeZone;
            TimeSpan timeSpan = localTimeZone.GetUtcOffset(greenwishTime);
            DateTime lacalTime = greenwishTime + timeSpan;
            return lacalTime;
        }

 

posted on 2016-09-22 17:40  雨悟极  阅读(500)  评论(0编辑  收藏  举报