Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Offsets

Status
Not open for further replies.

don2

IS-IT--Management
Jan 1, 2002
4
0
0
AU
This is probably so simple but I want to display different time zones but don't know how to add or subtract say 60 mins to the pc time for displaying???
 
create a new TDateTime object with a value of 1 in the hours argument:

/*Template*/
__fastcall TDateTime(unsigned short hour, unsigned short min, unsigned short sec, unsigned short msec);

get the current time, and add the two together;

TDateTime one_hour = TDateTime(1,0,0,0);
TDateTime time_now = TDateTime::CurrentDateTime();
TDateTime an_hour_from_now = time_now + one_hour;

these could be created as pointers in the header of your class and initialised in its constructor - but every time you want to update the time displays, you must refill the data with the current time and offset. The one_hour however can remain constant.

or you could just add 1/24 to the CurrentDateTime since this stores information in the form of 1=1day, hours minutes and seconds being stored as the equvalent fraction of 1(day).

hth
scalp
 
Thanks..this is what I am looking for..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top