I don't know why but you have to put a .
behind the month (short version).
I tried the following code:
QLocale locale("es");
qDebug() << locale.standaloneMonthName(6, QLocale::ShortFormat);
QDate date = locale.toDate("01-Jun.-14", "dd-MMM-yy");
qDebug() << date;
The output was surprisingly:
"Jun."
QDate("1914-06-01")
Locks like a bug to me and fails if i try to use it with a e.g. german locale.
Update: Ok, i got it. This is pretty confusing. You have to take the short name given by locale.monthName
. This is for e.g. "jun." for ES and "Juni" for DE. This does not really make any sense. In germany the short name for "Juni" is "Jun". For spain i do not know it. This is a bug.
Update 2: I think i understand the system (at least for the german locale). If the full name is larger than 4 characters (e.g. "Januar") the short version is the real short form ("Jan") with a dot appended ("Jan."). If the full name is shorter than 4 characters the short form is exactly the same as the long form (e.g. "Mai"). But i do not get why a dot is appended, since for the EN locale no dot is appended.