lpd
asked on
Set new sysdate from delphi 2.0, 3.0
I need a procedure that can change the system date and time
I use both win95 and NT
I use both win95 and NT
Are you using NT or 95?
ASKER
Edited text of question
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thank you
it works fine but, a have a small problem with timezones. the procedure that you wrote will set the time as if the timezone was GMT. Do you know how to see that timezone that currently is in use ?
it works fine but, a have a small problem with timezones. the procedure that you wrote will set the time as if the timezone was GMT. Do you know how to see that timezone that currently is in use ?
ASKER
Ah, that would explain why I need to -2 for hour!!
To get current timezone bias, use GetTimeZoneInformation.
E.g.
var
MinutesDiff: Integer;
TZInfo: TTimeZoneInformation;
begin
GetTimeZoneInformation(TZI nfo);
MinutesDiff := TZInfo.Bias;
end;
In my case, MinutesDiff = -120 (i.e. 2 hrs behind).
JB
To get current timezone bias, use GetTimeZoneInformation.
E.g.
var
MinutesDiff: Integer;
TZInfo: TTimeZoneInformation;
begin
GetTimeZoneInformation(TZI
MinutesDiff := TZInfo.Bias;
end;
In my case, MinutesDiff = -120 (i.e. 2 hrs behind).
JB
P.S. If you don't want do the TimeZone thing, use SetLocalTime instead of SetSystemTime.
JB
JB
Thanks agin