Questions tagged [qdatetime]

A QDateTime is a class from the Qt toolkit which provides functions for working with both dates and times.

A QDateTime object is a combination of the QDate and QTime classes which contains information about a calendar date and clock time. It can read the current date and time from the system clock, and also provides functions for comparing, formatting and parsing date/times, and for performing basic date/time calculations.

The official documentation can be found here.

88 questions
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
0 answers

PYQT QDateTimeEdit and "dd.MM.yyyy" format

I am having a little problem with entering the date. The date should be entered in the format DD.MM.YYYY (e.g. 03.06.2021) When I want to enter 31.05.2021 I have to jump to the month first, enter there 05 and then I can enter 31. June got 30 days…
Andy
  • 5
  • 1
0
votes
2 answers

PyQt5 - QDateTimeEdit spinbox rollover

I am building an app to download log files from a specific FTP platform, where I also want the user to be able to select start and stop dates in separate QDateTimeEdit widget. This will let the program choose the appropriate log files. When users…
Chokehold
  • 67
  • 7
0
votes
1 answer

Subtract two QDateTime

My problem is trying to find the time difference between two different QDateTime. I can not find a function that subtracts QDateTime. Would I have to make it to a string and create a function that subtracts or make it to a list and create a function…
Siming Jia
  • 25
  • 1
  • 6
0
votes
2 answers

QDateTime::toSecsSinceEpoch() seems not to work

Some theory first: According to the Qt Documentation the QDateTime::toSecsFromEpoch() function: Returns the datetime as the number of seconds that have passed since 1970-01-01T00:00:00.000, Coordinated Universal Time. and: [...] for all valid…
sweak
  • 1,369
  • 2
  • 6
  • 21
0
votes
1 answer

convert to date format in pyqt5 Qprinter

Is there a way to convert to date format will use the Printer and QTextDocument the result always show in the date and time like in the image? this is my code def handlePaintRequest(self, printer): model_hjd = QSqlTableModel() …
0
votes
1 answer

QDateTime::toString() fails when used in exit handler

I tried to log std::exit calls in my GCC10 compiled Qt 5 application. This fails when turning a QDateTime object into a string. It can be reproduced with the following snippet: void exitHandler() noexcept { QString b =…
Silicomancer
  • 8,604
  • 10
  • 63
  • 130
0
votes
1 answer

How to convert qdatetime into sql datetime and select from sql table in python?

User choose the QDateTime and I need to write query in pyodbc which selects items in table which date are greater than choosen date. How to convert it in sql datetime? And how to write this request?
Foo Boy
  • 9
  • 4
0
votes
1 answer

Changing Timezoneid with QTimzone in Qtcreator

I made a simple app displaying local time, utc time and the timezone offset. By default my qt app uses my local timezone "Europe/Amsterdam". But i want it to change when a new timezone is selected with the QCombobox which has a list of all the iana…
Esocoder
  • 1,032
  • 1
  • 19
  • 40
0
votes
2 answers

Datetime picker selection getting auto update

On iOS platform after selection Datetime picker(q-datetime-picker), text-field getting update automatically. Date picker bug
Sachin Kumaram
  • 900
  • 1
  • 10
  • 27
0
votes
1 answer

QTime to String with AM/PM and installed translator

This little application make some problems: int main(int argc, char *argv[]) { QTranslator* translator = new QTranslator(); QString langCode = "en_GB"; translator->load(QString("Core_%1.qm").arg(langCode)); …
Marcus
  • 1,910
  • 2
  • 16
  • 27
0
votes
2 answers

Can not convert QString to QDateTime

I have to convert QString to QDateTime by QDateTime::fromString method. I have QString object which contains "Wed, 13 Jun 2018 12:52". But when I use it QDateTime::fromString returns invalid object and I don't knew why. I use "ddd, MM-MMM-yyyy…
Viss
  • 11
  • 3
0
votes
1 answer

How to update a QTableView cell with a QDate selection?

I've added QDateEdit delegates to QTableView cells and want to update them with the date, but I can't figure out the correct connect syntax. dateChanged.connect(item.setText) doesn't work, because QDateEdit returns a QDate object, which needs needs…
Nemo XXX
  • 644
  • 2
  • 14
  • 35
0
votes
4 answers

Bad Values in QDateTimeAxis (QtCharts)

I am using QtCharts to display simulation data. The simulation starts at time zero, but my chart axis always seems to start at 19 hours. This confounds me. The set up of the chart is straight forward: std::vector data; // ... Populate…
DiB
  • 554
  • 5
  • 19
0
votes
2 answers

QDateTimeEdit - Hour/Minutes sections resets to empty when focus is lost

I have a QDateTimeField with mask set as HH:mm Consider a scenario where user deletes (for example) hour section like this: If user empties the hour section and subsequently press enter, hour section resets to 00 (which is the expected behavior,…
warunanc
  • 2,221
  • 1
  • 23
  • 40