Indy 9
|
function DateTimeToGmtOffSetStr(ADateTime: TDateTime; SubGMT: Boolean): string;
ADateTime is the native Date/Time value containing the number of hours and minutes to use for the local timezone. ADateTime is not a complete Date/Time value.
SubGMT indicates that the return value should substitute the prefix "GMT" for a time difference string where the offet is 0 hours and 0 minutes. When SubGMT is True, the prefix is used as the time difference string, otherwise the prefix is omitted.
DateTimeToGmtOffSetStr calls DecodeTime to extract the hour and minute components of ADateTime. When ADateTime contains a negative offset, the return value is formatted using the convention:
-HHMM
When ADateTime contains a positive offset, the return value is formatted using the convention:
+HHMM
Where HH represents the 2-digit number of hours in the offset, and MM represents the 2-digit number of minutes in the offset.
To convert an Internet GMT difference string to a TDateTime value that can be used in Date arithmetic operations, use the GmtOffsetStrToDateTime function.