Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-08-2001, 08:03 PM
Excalibur Excalibur is offline
Junior Member
 
Join Date: Jan 2001
Posts: 16
Default About the time...?

How can I calculate the correct time in my Zone....Because I dont want to take the time of the system. Thanks a lot.
Reply With Quote
  #2  
Old 01-08-2001, 08:52 PM
douglas douglas is offline
Senior Member
 
Join Date: Jul 2001
Posts: 7,695
Default RE: About the time...?

I don't know exactly how you specify what timezone you are comparing against, but try looking at this function:

GetTimeZoneInformation()
Reply With Quote
  #3  
Old 01-09-2001, 04:12 AM
The Smurf The Smurf is offline
Member
 
Join Date: Jan 2001
Posts: 40
Default RE: About the time...?

If you require time information, there is no other way to retrieve it except asking for the system time. A computer can't just read a clock.

There are two API functions that will retrieve the time, GetSystemTime and GetLocalTime. They both return the same information. The only difference is the way that the information is returned.

The GetLocalTime API function will return the current time
in the time zone specified in the control panel.

http://leb.net/wine/WinDoc/msdn/sdk/platforms/doc/sdk/win32/func/src/f33_18.htm

The GetSystemTime API funciton will return the current time in UTC format.

http://leb.net/wine/WinDoc/msdn/sdk/platforms/doc/sdk/win32/func/src/f40_8.htm

-- The Smurf
Reply With Quote
  #4  
Old 01-09-2001, 09:07 AM
Excalibur Excalibur is offline
Junior Member
 
Join Date: Jan 2001
Posts: 16
Default RE: RE: About the time...?

Ok, thanks for the answer...but I can I put the information of GetLocalTime in a label......??? Thank you.
Reply With Quote
  #5  
Old 01-09-2001, 12:13 PM
The Smurf The Smurf is offline
Member
 
Join Date: Jan 2001
Posts: 40
Default RE: RE: RE: About the time...?

Yes you can. Just call GetLocalTime and pass a TSystemTime structure to it in the function call. Then, you can use any of the members of the structure in your program. The members are:

wYear
wMonth
wDay
wDayOfWeek
wHour
wMinute
wSecond
wMilliseconds

They're all integer values, so you need to convert them to strings or PChars if you want to use them for output. Here's a bit of sample code:

var
thistime: TSystemTime;
begin
GetLocalTime(thistime);
Label1.Caption:= IntToStr(thistime.wYear) + '/' + IntToStr(thistime.wMonth) + '/' + IntToStr(thistime.wDay);
end;

This would output the date (2001/01/09) to Label1's caption property.

-- The Smurf
Reply With Quote
  #6  
Old 01-10-2001, 02:07 PM
paulholden paulholden is offline
Senior Member
 
Join Date: Jan 2001
Posts: 714
Default RE: RE: RE: RE: About the time...? nooooooo

no that wasnt my question. sorry.
do u know how to open up the actual control panel applets, that are all in the control panel??
cheers
Paul
Reply With Quote
  #7  
Old 01-10-2001, 05:05 PM
The Smurf The Smurf is offline
Member
 
Join Date: Jan 2001
Posts: 40
Default RE: RE: RE: RE: RE: About the time...? nooooooo

Yes. See the thread about opening control panel applets.

-- The Smurf
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 05:46 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.