Upper case in QDateTime !!!!
Hi.I will try to explain the problem with my poor knowledge of english.
I've to use "If unmodified since" in a http header and according to RFC 1123 the format must be something like "Sun, 12 Mar 2006 10:00:00 GMT".
So i do:
Code:
QFileInfo dInfo
(*getFile
());
//getFile() returns a pointer to a file I've created QString format
("ddd, dd MMM yyyy hh:mm:ss");
QString httpDate
(dDate.
toTimeSpec(Qt
::UTC).
toString());
httpDate += " GMT";
and I get something like "sun, 12 mar 2006 10:00:00 GMT" even if in the Assistant I read that "ddd" should produce Sun with the upperCase and not with LowerCase and the same thing for MMM.
Is there anyone that knows why i get "day" instead of "Day"? because the request does not work with lower cases.Thanks!!:confused:
Re: Upper case in QDateTime !!!!
Where do you use that format variable?
Re: Upper case in QDateTime !!!!
Sorry.I removed that because it does not work and i forgot to readd it to the code.The code is:
Code:
QFileInfo dInfo
(*getFile
());
//getFile() returns a pointer to a file I've createdQDateTime dDate(dInfo.created()); QString format
("ddd, dd MMM yyyy hh:mm:ss");
QString httpDate
(dDate.
toTimeSpec(Qt
::UTC).
toString(format
));
httpDate += " GMT";
Re: Upper case in QDateTime !!!!
QDateTime::toString() is locale dependent. Try this:
Code:
QDateTime utcDate
= dDate.
toTimeSpec( Qt
::UTC );
httpDate += locale.toString( utcDate.date(), "ddd, dd MMM yyyy" );
httpDate += utcDate.toString( " hh:mm:ss GMT" );
Re: Upper case in QDateTime !!!!
It works. Thank you!!!!:)