当前位置:网站首页>Common date formatter and QT method for obtaining current time

Common date formatter and QT method for obtaining current time

2022-06-24 08:30:00 Pepsi__

Common date formatter and its meaning :

character significance
yy year , Two digit display ,00-99
yyyy year , Four digit display , Such as 2016
M month , Display without zero padding ,1-12
MM month , Zero filling display ,01-12
d God , Display without zero padding ,1-31
dd God , Zero filling display ,01-31
h Hours , No zeros ,0-23 or 1-12( If it shows AM/PM)
hh Hours , Zero compensation 2 Bit display ,00-23 or 01-12( If it shows AM/PM)
H Hours , No zeros ,0-23 or 1-12( Even if it shows AM/PM)
HH Hours , Zero compensation 2 Bit display ,00-23 or 01-12( Even if it shows AM/PM)
m minute , No zeros ,0-59
mm minute , Zero filling display ,00-59
z millisecond , No zeros ,0-999
zzz millisecond , Zero compensation 3 Bit display ,000-999
AP or A Use AM/PM Show
ap or a Use am/pm Show

Text conversion date :

QDateTime dateTime = QDateTime::fromString("2022/06/23 23:05:24","yyyy/MM/dd hh:mm:ss");

Date conversion text :

QString timeStr = QDateTime::currentDateTime().toString("yyyy year MM month dd Japan  hh when mm branch ss second ");
QString timeStr1 = dateTime.toString("yyyy year MM month dd Japan  hh when mm branch ss second ");
原网站

版权声明
本文为[Pepsi__]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240558136599.html