2017-10-02 Fred Gleason <fredg@paravelsystems.com>

* Added an '%s' datetime wildcard for Service Name.
This commit is contained in:
Fred Gleason
2017-10-02 08:31:09 -04:00
parent 2992fcd5c9
commit 75883359b9
8 changed files with 43 additions and 18 deletions

View File

@@ -22,7 +22,7 @@
#include <rddatedecode.h>
QString RDDateDecode(QString str,QDate date)
QString RDDateDecode(QString str,const QDate &date,const QString &svcname)
{
QString string;
int yearnum;
@@ -117,6 +117,12 @@ QString RDDateDecode(QString str,QDate date)
field=QString().sprintf("%02d",date.month());
break;
case 's': // Service name
if(!svcname.isEmpty()) {
field=svcname;
}
break;
case 'u': // Day of week (numeric, 1..7, 1=Monday)
field=QString().sprintf("%d",date.dayOfWeek());
break;
@@ -164,7 +170,8 @@ QString RDDateDecode(QString str,QDate date)
}
QString RDDateTimeDecode(QString str,QDateTime datetime)
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
const QString &svcname)
{
QString string;
int yearnum;
@@ -291,6 +298,12 @@ QString RDDateTimeDecode(QString str,QDateTime datetime)
field=QString().sprintf("%02d",datetime.time().second());
break;
case 's': // Service name
if(!svcname.isEmpty()) {
field=svcname;
}
break;
case 'u': // Day of week (numeric, 1..7, 1=Monday)
field=QString().sprintf("%d",datetime.date().dayOfWeek());
break;

View File

@@ -23,8 +23,9 @@
#include <qdatetime.h>
QString RDDateDecode(QString str,QDate date);
QString RDDateTimeDecode(QString str,QDateTime datetime);
QString RDDateDecode(QString str,const QDate &date,const QString &svcname="");
QString RDDateTimeDecode(QString str,const QDateTime &datetime,
const QString &svcname="");
#endif // RDDATEDECODE