摘要: function UTCToLocalTime( UTCTime : TDateTime; iTimeZoneBias:integer ): TDateTime;var LocalSTime, UTCSTime : TSystemTime; TZInfo : TTimeZoneInformation; PTZInfo : PTimeZoneInformation; CalcResult : LongBool; LastError : LongInt;begin GetTimeZoneInformation( TzInfo ); Tzinfo.bias := Tzinfo.bias + iTim 阅读全文
posted @ 2012-10-07 23:08 Max Woods 阅读(770) 评论(0) 推荐(0) 编辑
摘要: Delphi/Pascal view sourceprint?1 function TimeZoneBias: Integer;var TZI: Windows.TTimeZoneInformation; // info about time zonebegin if Windows.GetTimeZoneInformation(TZI) = Windows.TIME_ZONE_ID_INVALID then SysUtils.RaiseLastOSError; Result := TZI.Biasend; 阅读全文
posted @ 2012-10-07 23:07 Max Woods 阅读(659) 评论(0) 推荐(0) 编辑
摘要: eg. var tm : string; dt : tdatetime;tm := '2009-08-21T09:11:21Z'; dt := ?procedure setISOtoDateTime(strDT:string);var // Delphi settings save vars ShortDF,ShortTF:string; TS, DS :char; // conversion vars dd, tt, ddtt:TDateTime;begin // example datetime test string in ISO format strDT :=' 阅读全文
posted @ 2012-10-07 23:03 Max Woods 阅读(513) 评论(0) 推荐(0) 编辑
摘要: 每个地区都有自己的本地时间,在网上以及无线电通信中时间转换的问题就显得格外突出。我自己就经常混淆于此,特地研究了一下,记录在此以备忘。 整个地球分为二十四时区,每个时区都有自己的本地时间。在国际无线电通信场合,为了统一起见,使用一个统一的时间,称为通用协调时(UTC, Universal Time Coordinated)。UTC与格林尼治平均时(GMT, Greenwich Mean Time)一样,都与英国伦敦的本地时相同。在本文中,UTC与GMT含义完全相同。 北京时区是东八区,领先UTC八个小时,在电子邮件信头的Date域记为+0800。如果在电子邮件的信头中有这么一行: Date: 阅读全文
posted @ 2012-10-07 22:58 Max Woods 阅读(352) 评论(0) 推荐(0) 编辑
摘要: 在SOA环境中,经常遇到时间,日期错乱的情况明明在A端发的日期是2012-05-11,B端却收到2012-05-10, 什么情况?原因在于.net的反序列化会自动把DateTime类型的字段,转为本地时间e.g. 如果B所在的服务器,本地时区设置为太平洋时间 -7区:"2012-10-21" 转化为 "2012-10-21 12:00:00 AM" "2012-10-21-07:00" 转化为"2012-10-21 12:00:00 AM" "2012-10-21+00:00" 转化为" 阅读全文
posted @ 2012-10-07 22:46 Max Woods 阅读(365) 评论(0) 推荐(0) 编辑