Главная страница | назад





Article #15094: How to manipulate a TDateTime object

 Question and Answer Database
FAQ94C.txt How to manipulate a TDateTime object
Category :VCL
Platform :All
Product :C++Builder 1.x
Question:
How do I do something as simple as adding 1 minute to a TDateTime
Object?
Answer:
Use the overloaded operators that come with the TDateTime type as so:
MyTDTime += (1.0/1440.0);
this adds one(1) minute to the current time which is really a
double. The fractional part of the TDateTime double is the time
of day and as there are 1440 minutes in a day, the above will
add one. Also is is important to note that TDateTime is NOT a VCL
object so can (and I'd say should) be allocated non-dynamically,
ie:
TDateTime MyTDTime;
enjoy!
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99