[PyQt] SystemLocaleShortDate omits the century on Linux
Maurizio Berti
maurizio.berti at gmail.com
Wed Mar 11 19:47:44 GMT 2020
Taken from QDate.toString (https://doc.qt.io/qt-5/qdate.html#toString-1):
If the format is Qt::SystemLocaleShortDate or Qt::SystemLocaleLongDate, the
> string format depends on the locale settings of the system.
It completely depends on how the system "tells" what is the date format.
Apparently, Windows defaults to 4 digits for your localization, while it's
set to 2 for Linux.
You can change them in both systems: in Windows it's on the regional
settings, while on Linux it depends on your distro/window manager/etc.
Maurizio
Il giorno mer 11 mar 2020 alle ore 19:19 Sibylle Koczian <
nulla.epistola at web.de> ha scritto:
> Hello,
>
> on Windows SystemLocaleShortDate gives 'dd.MM.yyyy', quite correct for
> locale de-DE.
>
> On Linux (at least on ArchLinux, I didn't try other distributions) it
> gives 'dd.MM.yy' with the same locale.
>
> The documentation calls SystemLocaleShortDate "The short format used by
> the operating system". But the locale's date representation as given by
> "date +%x" in the Linux terminal shows the date as it should be,
> including the century.
>
> Why the difference?
>
> It is especially annoying with dates from this year in a QTableView: I
> always try to drag the date column wider which doesn't help.
>
> Looking for explanations,
> Sibylle
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
--
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20200311/8bd98118/attachment.htm>
More information about the PyQt
mailing list