c++builder-xetdatetime

How to replace Day of TDateTime type on runtime


I have TDateTime variable named dtBegin. dtBegin is containing value "7/3/2000". I need to replace the Day only with "2" to change the value into "2/3/2000".

How to do this? I've been suggested to use RecodeDay() method in C++ Builder XE but the method is not worked. I put the dtBegin on the method to be:

RecodeDay(dtBegin, 2);

But the method is not returning the value that I want.

Is there any method to do this? Help me please. Thanks in advance.


Solution

  • RecodeDay is a function declared as System::TDateTime __fastcall RecodeDay(const System::TDateTime AValue, const System::Word ADay);, so you need to store the return value:

    dtBegin = RecodeDay(dtBegin, 2);