[PyQt] SystemLocaleShortDate omits the century on Linux
barry at barrys-emacs.org
Tue Mar 17 21:43:39 GMT 2020
> On 11 Mar 2020, at 19:47, Maurizio Berti <maurizio.berti at gmail.com> wrote:
> Taken from QDate.toString (https://doc.qt.io/qt-5/qdate.html#toString-1 <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.
I think you will find it depends on glibc's localisation database.
I would be surprised if distro's patch that. Surprised not shocked.
If GUI tool kits have code to do this as well it is possible that
command line (Glibc) programs give different answer then GUI's.
> Il giorno mer 11 mar 2020 alle ore 19:19 Sibylle Koczian <nulla.epistola at web.de <mailto:nulla.epistola at web.de>> ha scritto:
> 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,
> PyQt mailing list PyQt at riverbankcomputing.com <mailto:PyQt at riverbankcomputing.com>
> https://www.riverbankcomputing.com/mailman/listinfo/pyqt <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 <http://www.jidesk.net/>_______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt