TAdvStringGrid TDateTimePicker shows wrong month after upgrade from Rad Studio 10.4 to 11.2

After upgrading Rad Studio and TMS VCL UI Pack we experience a problem with date fields inside of a TAdvStringGrid. The value is stored correctly, but in edit mode the month is completely wrong (like 44).




Do you perhaps have an idea, what could be the cause? There have been no explicit changes in the corresponding code during upgrade. The format sring used is "dd.mm.yyyy".

I have not seen this before. What happens when you use the standard TDateTimePicker directly on the form?
What is the OS and what is the setting for FormatSettings.ShortDateFormat?

Using TDateTimePicker directly works correctly.




Its german Win10 Enterprise 22H2 and FormatSettings.ShortDateFormat is "dd.mm.yyyy".

With a default grid on the form configured with

procedure TForm1.FormCreate(Sender: TObject);
  formatsettings.ShortDateFormat  := 'dd.mm.yyyy';
  formatsettings.DateSeparator := '.';
  advstringgrid1.DefaultEditor := edDateEdit;
  advstringgrid1.Options := advstringgrid1.Options + [goEditing];

and I could not see this issue.
Do you use any specific settings / events handlers / code?

It's quite large C++ project with huge code basis. But concerning DateTimePicker I could only find 2 places.

  1. In event OnDatePickerDropDown the format is set from system like
    advStringGrid->DateTimePicker->Format = "dd.mm.yyyy";
  2. In event OnGetEditText the format is set to empty string, if the corresponding field has no value (to prevent setting the today date by default). Otherwise again to system "dd.mm.yyyy".

Set the format to "dd.MM.yyyy";

Setting it manually to "dd.MM.yyyy" works fine!
Actually we fetch the format string from the system using following code:

TFormatSettings cFormatSettings = TFormatSettings::Create( GetThreadLocale() );
UnicodeString sShortDateFormat( cFormatSettings.ShortDateFormat );

And we have also customers, who use our product in english environment. So we have to fetch it from system and can't set it manually. Would you advise us to replace the substring "mm" with "MM" after fetching it from system?

In the scope of this datetimepicker control (that can edit both date & time), MM is for months and mm is for minutes. So you might want to force it to MM

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.