setDateTimeFormat 增加一个小时

setDateTimeFormat adds an hour

我想以 hh:mm:ss 格式显示我的 x 轴。它基本上可以工作,但是有一个问题。显示的时间不是从00:00:00开始,而是从01:00:00开始。我想可能是因为时间处于 ap 模式,但我没有具体说明,我是这样做的:

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

点 0 的情节从第 1 小时开始:

对于这方面的所有帮助,我将不胜感激。如何让起点0显示为00:00:00?

使用HH(或H以避免前导零)。小写 h 用于 AM/PM 小时格式,从 1 开始计数。

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

如果问题仍然存在,应该是时区问题。添加

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

之前 SetTimeFormat