0

I would like to display my x axis in the hh:mm:ss format. It basicaly works, but there is one problem. The displayed time doesnt start from 00:00:00 but from 01:00:00. I thought maybe its because the time is in ap mode, but I havent specified that, here is how I do it:

customPlot->xAxis->setTickLabelType(QCPAxis::ltDateTime);
customPlot->xAxis->setDateTimeFormat("hh:mm:ss");

And the plot at point 0 starts from hour 1:

enter image description here

I would appreciate all help regarding this. How to make the starting point 0 shown as 00:00:00?

4

1 回答 1

2

Use HH (or H to avoid the leading zero). Lowercase h is for AM/PM hour format, which starts to count from 1.

Font: http://doc.qt.io/qt-5/qdatetime.html#toString

If the problem still persists, it should be timezone related. Add

customPlot->xAxis->setDateTimeSpec(Qt::UTC)

before SetTimeFormat

于 2015-06-27T21:39:50.040 回答