Skip to content

Commit

Permalink
Fixing #562 - CSV Export: Time and Date formats use ISO8601 format - …
Browse files Browse the repository at this point in the history
…yyyy-MM-dd hh:mm:ss
  • Loading branch information
foldynl committed Jan 15, 2025
1 parent bb6c5a5 commit 642c8aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
10 changes: 10 additions & 0 deletions logformat/CSVFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,16 @@ void CSVFormat::writeField(const QString &name,
currectRecord[name] = csvStringValue(value);
}

const QString CSVFormat::toDate(const QVariant &var)
{
return var.toDate().toString("yyyy-MM-dd");
}

const QString CSVFormat::toTime(const QVariant &var)
{
return var.toTime().toString("hh:mm:ss");
}

QString CSVFormat::csvStringValue(const QString &value)
{
FCT_IDENTIFICATION;
Expand Down
3 changes: 3 additions & 0 deletions logformat/CSVFormat.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class CSVFormat : public AdxFormat
bool presenceCondition,
const QString &value,
const QString &type="") override;
const QString toDate(const QVariant &) override;
const QString toTime(const QVariant &) override;

private:
QMap<QString, int> header;
QList<QHash<QString, QString>> exportedRecords;
Expand Down

0 comments on commit 642c8aa

Please sign in to comment.