- wxString x_format(wxT("%x"));
- wxString fmt;
- int year_cnt = 0, month_cnt = 0, day_cnt = 0;
-
- wxDateTime dt;
- dt.ParseFormat(wxT("2003-10-17"), wxT("%Y-%m-%d"));
- wxString str(dt.Format(x_format));
-
- const wxChar *p = str.c_str();
- while ( *p )
- {
- if (wxIsdigit(*p))
- {
- int n=wxAtoi(p);
- if (n == dt.GetDay())
- {
- fmt.Append(wxT("%d"));
- day_cnt++;
- p += 2;
- }
- else if (n == (int)dt.GetMonth()+1)
- {
- fmt.Append(wxT("%m"));
- month_cnt++;
- p += 2;
- }
- else if (n == dt.GetYear())
- {
- fmt.Append(wxT("%Y"));
- year_cnt++;
- p += 4;
- }
- else if (n == (dt.GetYear() % 100))
- {
- if ( HasDPFlag(wxDP_SHOWCENTURY) )
- fmt.Append(wxT("%Y"));
- else
- fmt.Append(wxT("%y"));
- year_cnt++;
- p += 2;
- }
- else
- // this shouldn't happen
- return x_format;
- }
- else {
- fmt.Append(*p);
- p++;
- }
- }
-
- if (year_cnt == 1 && month_cnt == 1 && day_cnt == 1)
- return fmt;
-
- return x_format;
+#if wxUSE_INTL
+ wxString fmt = wxLocale::GetInfo(wxLOCALE_SHORT_DATE_FMT);
+ if ( HasDPFlag(wxDP_SHOWCENTURY) )
+ fmt.Replace("%y", "%Y");
+
+ return fmt;
+#else // !wxUSE_INTL
+ return wxT("x");
+#endif // wxUSE_INTL/!wxUSE_INTL