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
1
vote
2 answers

QLocale toDate always return invalid QDate on "es" locale

Why this code return an invalid date? QLocale locale("es"); QDate date = locale.toDate("1-Jun-14", "d-MMM-yy"); If debug the locale variable, it is initialized correctly to locale es_ES, but doesn't return the date and date.isValid() returns false.
mabg
  • 1,894
  • 21
  • 28
1
vote
2 answers

Problems to convert a QString to QDateTime

i have a problem to convert a QString to a QDataTime-Object. The String looks like: "2008:09:23 14:18:03 and have a length of 20. The Problem is, if i remove the first character the output looks like: "008:09:23 14:18:03. That's wrong with it? Can i…
501 - not implemented
  • 2,638
  • 4
  • 39
  • 74
1
vote
1 answer

QDate into QString

I have a question about PyQt4. I have a date that is of a type QDate and I want to simply turn it into a string format as opposed to QDate format. For example, if the date is 09/16/2013, I would want to change it into a string form of September 16,…
user1871869
  • 3,317
  • 13
  • 56
  • 106
1
vote
2 answers

Changing the way QDate displays date format

My app has a has a QTreeWidget that takes a QDate in one of its columns. Since the columns accept QVariants they can hold practically any kind of data. I've found that the TreeWidget must use the actual QDate objects instead of QStrings for the…
Will Kraft
  • 553
  • 1
  • 8
  • 23
0
votes
0 answers

QDate toString(fromString) -> setText(Label)

I am new to Qt UI designer. We got a task to read a txt file, get a string out of it, and print it to a label via QDate. So what I need, is to read a string, format it to QDate, and then format it to QString. I tried doing it without an instance of…
0
votes
1 answer

Why is QDate.daysTo( ) segfaulting?

I'm puzzled why this crashes. I can paste these two lines into a python shell and reliably get a segfault and be kicked out of the Python session: from PyQt5.QtCore import QDate QDate(2011, 1, 2).daysTo(QDate(2012, 1, 1)) Adding try/except won't…
DarenW
  • 16,549
  • 7
  • 63
  • 102
0
votes
1 answer

Qt Qdate function in C++ problem with year

Simple question: I'd like to write current date in a file. The following is my code: void fileWR::write() { QFile myfile("date.dat"); if (myfile.exists("date.dat")) myfile.remove(); myfile.open(QIODevice::ReadWrite); QDataStream out(&myfile); out…
LittleSaints
  • 391
  • 1
  • 6
  • 19
0
votes
1 answer

Quasar q-date component, how to disable double click?

I need to disable the double-click action on the Q-Date Quasar control but there is no reference on the documentation. There is a way to disable it?
0
votes
0 answers

QT detect when a given date time is under day light saving or not

We have an application that is failing because of DST, we use EST or New york time as our reference, I want to know whethere a given DateTime (QDateTime) is under DST or not, say if I pass Nov 2, 2021 i want to know if that date is under DST (Which…
curiousJorgeXX
  • 363
  • 1
  • 10
0
votes
1 answer

QDate is not convertible to datetime

I have a geodataframe which I'm adding some column data to, all the same length, to get this in the correct format for another application I do the following: revdate = datetime.date(1999, 12, 20).strftime("%Y-%m-%d") gdf =…
Spatial Digger
  • 1,883
  • 1
  • 19
  • 37
0
votes
1 answer

QDateEdit - paint cell of calendarPopup

I create custom form and user interface components with Qt Designer and use Qt's integrated build tool uic, to generate code for them when the application is built. The generated code contains the form's user interface object. I have QDockWidget…
ncica
  • 7,015
  • 1
  • 15
  • 37
0
votes
2 answers

How to obtain first Friday from a given QDate?

Consider a Qdate from QDate Mydate = ui->dateEdit->date(); For example, suppose we choose 2018/07/14 (today). How to obtain the day of the first Friday (in this case, 6) on the chosen month (in this case, July)? I suspect we have to use…
Sigur
  • 355
  • 8
  • 19
0
votes
1 answer

error: no match for 'operator+' (operand types are 'const QString' and 'QDate')

I do have problem with declaring QDate and when I used the declared word(value) in the DB insert function with that related value, its keep on prompting with an error. Please do guide and correct me. I have done my part but still it's giving…
joeBoy69
  • 21
  • 3
0
votes
1 answer

Forward declaration of QDate class gives errors

I'm developing an application using Qt Widgets. In my header files, I like to forward declare classes instead of including them. At the beginning of a header file I put forward declarations as follows: class QFile; class QDate; class QTime; And,…
ukll
  • 204
  • 2
  • 12
0
votes
1 answer

Qml Locale has same format for ShortFormat and NarrowFormat

I'm trying to display the date (and time) using the toLocaleDateString / toLocateTimeString methods implemented on the Date type in Qml (doc here). It works, except for the ShortFormat which is the same as the NarrowFormat. Here's an example: import…
lesurp
  • 343
  • 4
  • 19