Boron
9th October 2008, 19:14
Hello,
I need to display the application build date in an application.
So I'm using the following construction. From the date object I can later extract weekday, month an year easily.
QString dateString = __DATE__;
QDate date = QDate::fromString( dateString.simplified(), "MMM d yyyy" );
My problem is that the MS C++ compiler (Visual Studio 2005 and 2008) is giving __DATE__ in this form (today): Oct 9 2008. Notice the "c" in Oct, which is correct for the english "october".
As I have a german WinXP with german locale settings QDate expects the german shortform of "Oktober", which is "Okt", of course.
As result the fromString() method fails to successfully parse the dateString because it expects "Okt" and not "Oct" and date remains 0. Today's date is shown as "1. Januar -4713" in my application. That was shortly before the invention of the wheel :D.
I played around with QLocale class but I don't know how to tell fromString(), that it has to expect the english form "Oct".
Does anybody has an idea what to do?
I need to display the application build date in an application.
So I'm using the following construction. From the date object I can later extract weekday, month an year easily.
QString dateString = __DATE__;
QDate date = QDate::fromString( dateString.simplified(), "MMM d yyyy" );
My problem is that the MS C++ compiler (Visual Studio 2005 and 2008) is giving __DATE__ in this form (today): Oct 9 2008. Notice the "c" in Oct, which is correct for the english "october".
As I have a german WinXP with german locale settings QDate expects the german shortform of "Oktober", which is "Okt", of course.
As result the fromString() method fails to successfully parse the dateString because it expects "Okt" and not "Oct" and date remains 0. Today's date is shown as "1. Januar -4713" in my application. That was shortly before the invention of the wheel :D.
I played around with QLocale class but I don't know how to tell fromString(), that it has to expect the english form "Oct".
Does anybody has an idea what to do?