Questions tagged [qdate]

A QDate is a class from the Qt toolkit which provides functions for working with dates.

A QDate object contains information about a calendar date (for example its year, month, and day numbers), and can read the current date from the system clock. It also provides functions for comparing, formatting and parsing dates, and can perform basic date calculations.

The official documentation can be found here.

39 questions
15
votes
1 answer

How to convert QString to QDate in specific format?

I have a QDateEdit in my GUI from which I convert the QDate to QString and add it to my database. The QString date is saved in the database in this format: 20/12/2015. In case a user want to edit the date, then I need to show the date on the…
McLan
  • 2,552
  • 9
  • 51
  • 85
10
votes
3 answers

Qt ISODate formatted date/time including timezone

Does anyone know of a cleaner way to get the time zone included in the ISO string representation of a QDateTime? I should be able to just use the following: qDebug() << QDateTime::currentDateTime().toString(Qt::ISODate); but this always comes out…
RobbieE
  • 4,280
  • 3
  • 22
  • 36
7
votes
1 answer

How can you convert QDate in PyQt5 to a datetime.date?

I am trying to convert a date gathered from a QDateEdit into datetime.date for use in a sqlite3 database. I have seen that in PyQt4 you could use toPyDateTime however it doesnt seem to be in PyQt5. If this function is completely gone is there a way…
user1921942
  • 121
  • 1
  • 2
  • 9
3
votes
1 answer

How to display a selected date and a number in Qt

I'm currently working with the QCalendarWidget and I need some ideas to accomplish the following. What would be the best way to add the selecteDate from a QCalendarWidget and a number to some sort of table. What I want is basically to have a list of…
fs_tigre
  • 10,650
  • 13
  • 73
  • 146
3
votes
3 answers

QDate - wrong year

I have the following situation: QDate fixDate = QDate::fromString(QString("270912"), "ddMMyy"); the year returned is 1912. I do not understand why and how get the correct year. Thanks in advance
Blackbelt
  • 156,034
  • 29
  • 297
  • 305
2
votes
1 answer

How to convert QDate to Python date object in PySide6

I have tried to get the date from QDateEdit so that I can save it to a database, but when I execute the code in PySide6 it gives me an error: value = self.ui.dateEdit.date() var_name = str(value.toPyDate()) Error: PySide6.QtCore.QDate object…
Eric paul
  • 101
  • 10
2
votes
1 answer

How to display a QDate-month with a different locale than system?

The function QDate::toString(const QString &format) allows to display the month name with MMM (e.g. 'Jan' to 'Dec') or MMMM (e.g. 'January' to 'December'). But this function uses the system locale from QLocale::system() (source code). What is the…
ymoreau
  • 3,402
  • 1
  • 22
  • 60
2
votes
2 answers

How can QML native `date` type be updated?

QML provides a date type that appears to be freely convertible to and from both the C++ QDate class and the QML Date type. The Date type is an extension of the JS Date type. Calling the set methods on a date property is apparently permissible,…
Kyle Strand
  • 15,941
  • 8
  • 72
  • 167
2
votes
1 answer

QInputDialog and QMessageBox

I'm doing some preparation for an exam using Qt framework and I would like to know how to use QInputDialog and QMessageBox in a basic way (my exams are hand written coding) The Qt API is really confusing to understand when it comes to using and it…
Barry Michael Doyle
  • 9,333
  • 30
  • 83
  • 143
1
vote
1 answer

Can I change default formatting for QDate::QString()?

QT's QDate::toString() function, without parameters, converts a QDate to a QString with a default format of "ddd MMM d yyyy". Our application is international and this fixed format does not reflect locale and regional settings. I don't want to use…
Seeker4
  • 25
  • 3
1
vote
1 answer

Full name month format in QCalendar sample

I need a calendar widget for the app I am writing in PyQt5 and I found this sample source code: import sys from PyQt5 import * from PyQt5.QtWidgets import QApplication, QCalendarWidget, QWidget, QLabel from PyQt5.QtCore import * from PyQt5.QtGui…
M.H Mighani
  • 196
  • 5
  • 19
1
vote
1 answer

QDate empty value on add product page

I have a form to insert a product on vector. My form is a QT dialog form and I'd like that the space where I insert the date of purchase is blank and when I click on the QDateEdit the current date appears and I can set the date I prefer. When I add…
Nicolò Scapin
  • 240
  • 1
  • 4
  • 15
1
vote
1 answer

How To store Value form QDateEdit in String?

I want to store value from QDateEdit to String. I'have used following code: QString str = ui->dateeditobject->date().toString("dd/mm/yyyy") But the problem is, that the month value is not being stored as you can see in the picture. Where am I going…
1
vote
2 answers

Qt LineEdit setInputMask() with setText() and QRegExp

I have a QLineEdit for Date in mm/dd/yyyy format. I am getting input using the keyboard and not using QDateEdit because of the requirement. And when the lineEdit comes to view, it has to show to the user the current date. I need the following for…
jxgn
  • 741
  • 2
  • 15
  • 36
1
vote
2 answers

Change the format of a QDate

I need to change the format of a QDate. Here is my code: yday = (QtCore.QDate.currentDate().addDays(-1)) And I got this result... PyQt4.QtCore.QDate(2015, 4, 2) But I need the date in this format: 2015/04/03
Dhivya Prabha
  • 77
  • 2
  • 8
1
2 3