Extract only hour from a qdatetime.
Unsolved
General and Desktop
-
Finding lots of examples on line about how to format the output of a qdatetime. Dozens of methods. No where can I find an example that ONLY extracts the hour.
I have an application that has to perform specific operations on given hours. Can anyone provide a link to such an example or just one code snippet to get this accomplished.
Thanks for any help -
QDateTime::time()
gives you a QTime value andQTime::hour()
gives you the hour value.QDateTime timestamp = ... int hour = timestamp.time().hour();