Python Forum
[PyQt] manage display date
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] manage display date
#2
The built-in module datetime is always helpful when handling dates and time
import datetime as dt

def insert_date(self):
    try:
        d = int(self.lineEdit_day.text())
        m = int(self.lineEdit_month.text())
        y = int(self.lineEdit_year.text())
        date = dt.date(y, m, d)
    except ValueError:
        self.textEdit_error_display.setText("invalid fields")
    else:
        self.lineEdit_date_introduced.setText("{:%d/%m/%Y}".format(date))
Reply


Messages In This Thread
manage display date - by atlass218 - Nov-11-2019, 04:16 PM
RE: manage display date - by Gribouillis - Nov-11-2019, 04:37 PM
RE: manage display date - by atlass218 - Nov-11-2019, 09:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] display the contents of the table in descending order of the date atlass218 14 7,259 Nov-18-2019, 03:20 PM
Last Post: Denni
  Display and update the label text which display the serial value jenkins43 5 9,204 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  Display more than one button in GUI to display MPU6000 Sensor readings barry76 4 4,010 Jan-05-2019, 01:48 PM
Last Post: wuf

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020