Internet Direct (Indy) Version 9.0.2 Beta
DateTimeToGmtOffSetStr
Retrieves the GMT time offset for a date/time value.

function DateTimeToGmtOffSetStr(ADateTime: TDateTime; SubGMT: Boolean): string;
Parameters
ADateTime: TDateTime
Value to be converted to a GMT offset string.

SubGMT: Boolean
Add the prefix "GMT" to the return value.

Returns
String - The offset from GMT time as a string.

Description
DateTimeToGmtOffSetStr is a String function used to return the time difference for the ADateTime parameter as an Internet Time difference string. The time difference contains the number of hours and minutes needed to adjust a time value the local timezone to GMT (Greenwich Mean Time). The return value for DateTimeToGmtOffSetStr is expressed in one of the following forms:

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.