Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
290
DateTime formatting
posted

Hi,

I'm trying to have a cell in the grid that allows user to see and input a datetime value. I'm using for this [UltraDateTimeEditor] which has the properties set as

datetimeEditor->FormatProvider = System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat;
datetimeEditor->MaskInput = "{date} {time}";
datetimeEditor->FormatString = System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->ShortDatePattern + " " +
System::Globalization::CultureInfo::CurrentUICulture->DateTimeFormat->LongTimePattern;

datetimeEditor->AutoFillTime = Infragistics::Win::UltraWinMaskedEdit::AutoFillTime::Midnight;
datetimeEditor->AutoFillDate = Infragistics::Win::UltraWinMaskedEdit::AutoFillDate::MonthAndYear;
datetimeEditor->Value = "00/00/0000 00:00:00";

but it display wrong datetime in a wrong format in a non-english enronment. See this image (windows is using Slovenian settings)
https://www.dropbox.com/s/8tjkzmgjbcjkomm/1.png?dl=1

How do I set properly the properties to mimic exactly the system settings?

Thx 

 

Parents
No Data
Reply
  • 469350
    Offline posted

    I don't see anything wrong with the settings you are using here, although there's no reason to set the FormatProvider to the same as the current culture - that's the default. 

    Also, I don't think the Value you are setting on the DateTimeEditor is valid. All 0's is less than the MinDate. But that should raise an exception, not show the wrong formatting. 

    Can you tell me what the System.Globalization.CultureInfo.CurrentCulture.Name of the CurrentCulture so I can try this out with the same culture you are using? 

Children