Implemented beginOfMonth() and endOfMonth()
This commit is contained in:
@@ -21,3 +21,15 @@ QTime timeNormalise(const QTime &time)
|
||||
{
|
||||
return QTime(time.hour(), time.minute());
|
||||
}
|
||||
|
||||
QDate beginOfMonth(QDate date)
|
||||
{
|
||||
bool success = date.setDate(date.year(), date.month(), 1);
|
||||
Q_ASSERT(success);
|
||||
return date;
|
||||
}
|
||||
|
||||
QDate endOfMonth(const QDate &date)
|
||||
{
|
||||
return beginOfMonth(date.addMonths(1)).addDays(-1);
|
||||
}
|
||||
|
@@ -8,3 +8,6 @@ int DBCORELIB_EXPORT timeToSeconds(const QTime &time);
|
||||
QTime DBCORELIB_EXPORT timeBetween(const QTime &l, const QTime &r);
|
||||
QTime DBCORELIB_EXPORT timeAdd(const QTime &l, const QTime &r);
|
||||
QTime DBCORELIB_EXPORT timeNormalise(const QTime &time);
|
||||
|
||||
QDate DBCORELIB_EXPORT beginOfMonth(QDate date);
|
||||
QDate DBCORELIB_EXPORT endOfMonth(const QDate &date);
|
||||
|
Reference in New Issue
Block a user