3
How do I return the previous month of the date reported in Qt, has some function in the QDate
what does it do? I just found the one that adds addMonths
. Example: month 04 reported returns month 03.
3
How do I return the previous month of the date reported in Qt, has some function in the QDate
what does it do? I just found the one that adds addMonths
. Example: month 04 reported returns month 03.
4
Yes, the method month()
do this.
QDate data(2015, 4, 6);
int mes = data.month();
According to the comment below what is desired is to subtract months, so use own addMonths()
, just use a negative value.
QDate data(2015, 4, 6);
int mesAnterior = data.addMonths(-1);
Browser other questions tagged c++ datetime qt qtgui
You are not signed in. Login or sign up in order to post.
bigown is now. How do I return the previous month(which is already past)? Example date.Month() returns month 04, now I would like it to return 03.
– Hy-brazil
It was not clear in the question that it was the previous month that you wished.
– Maniero
Thanks bigown. It worked now.
data.addMonths(-1).toString("dd/MM/yyyy");
– Hy-brazil