I happened to run into a case where I needed to do something that was dependent on the specific time in a specific time zone. Now something like this might be standard function in newer Delphis, but it didn't appear in either Delphi 3 or Turbo Delphi 2006. I ended up coming up with this to do the job: A "Now" function that will give me a time-zone dependent response. It may have issues, but for what I used it for, it seems to be working consistently.
function NowTZ(Bias: Integer): TDateTime;
// make a Now function that works on time zone.
// "Bias" is a UTC "minus" value. For example, CST is -6, EST is -5.
UTCTime, LocalTime: TSystemTime;
TZ.Bias := 0;
// set time zone biases for daylight savings time. This works for most of the US.
// DST ends at First Sunday in November at 2am
TZ.StandardDate.wMonth:= 11; // November
TZ.StandardDate.wDay:= 1; // First
TZ.StandardDate.wDayOfWeek:= 0; // Sunday
// DST starts at Second Sunday in March at 2am
TZ.DaylightDate.wMonth:= 3; // March
TZ.DaylightDate.wDay:= 2; // Second
TZ.DaylightDate.wDayOfWeek:= 0; // Sunday
SystemTimeToTzSpecificLocalTime(@TZ, UTCTime, LocalTime);
Result := SystemTimeToDateTime(LocalTime);
Calling it is very simple...if I want to know what the time is in the Eastern Time Zone: