MonthOf TDateTime ambiguity

157 Views Asked by At

I am using C++ Builder and am creating a GUI application using the TDateTime data type.

When I use the MonthOf() method on a TDateTime object, I am getting a value that is 1 month behind from the actual month of the TDateTime object.

Why is this? Is this a bug?

1

There are 1 best solutions below

1
On

If you want to get current month try this code:

TDateTime dt = Now();
CurMonth=StrToInt(FormatDateTime("mm", dt));