pyqt中QDateTimeEdit/QDateEdit相关使用方法

QDateTimeEdit/QDateEdit

clear (self)
QDate date (self)
QDateTime dateTime (self)
setDate (self, QDate date)
setDateTime (self, QDateTime dateTime)
setTime (self, QTime time)
QTime time (self)

 

now_day = time.strftime("%Y-%m-%d", time.localtime())
self.dateEdit.setDate(QDate.fromString(now_day, ‘yyyy-MM-dd‘))

 

now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())
self.dateTimeEdit.setDateTime(QDateTime.fromString(now_time, ‘yyyy-MM-dd hh:mm:ss‘))

 

QDate

QDate currentDate ()
QDate fromString (QString s, QString format)
QString toString (self, QString format)
(int year, int month, int day) getDate (self)
int day (self)
int month (self)
int year (self)

QDateTime

QDateTime currentDateTime ()
QDateTime fromString (QString s, QString format)
QString toString (self, QString format)
QDate date (self)
QTime time (self)

 

start_time = self.dateTimeEdit.dateTime()
end_time = self.dateTimeEdit_2.dateTime()

文章来自:http://www.cnblogs.com/hushaojun/p/4654712.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3