A
A
Anton2015-12-25 21:28:34
Qt
Anton, 2015-12-25 21:28:34

How to format a date pulled from a database?

There is a date_reg (DATETIME) field in the DB.

In the project I get it with the line:

QString date_reg = query.value(record.indexOf("date_reg")).toString();


If I try to format in "toString", then this comes out:
b5524a7cf41740179f09ba881a584aec.png

How to convert the date to the desired form?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
Jacob E, 2015-12-25
@hummingbird

What does it mean to format? What kind is needed?
Parse in QDateTime like this , output in the required format like this .

A
Alexander Ananiev, 2015-12-25
@SaNNy32

use QDateTime doc.qt.io/qt-4.8/qdatetime.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question