GMT Time To Local Time
3rd April 2008
Hi, have you guys , ever involved in creating application that will be used in different country or event different time zone ? well in most case ..all data that have DateTime value will be much saver if we saved it on GMT time basis.. and there for when we want to display the data to our GUI need to be converted into localize timed,bellow is some of the snippet that we can used ..
function GMTToLocalTime(GMTTime: TDateTime): TDateTime; var GMTST: Windows.TSystemTime; LocalST: Windows.TSystemTime; begin SysUtils.DateTimeToSystemTime(GMTTime, GMTST); SysUtils.Win32Check(Windows.SystemTimeToTzSpecificLocalTime(nil, GMTST, LocalST)); Result := SysUtils.SystemTimeToDateTime(LocalST); end;
