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()

posted on 2015-07-17 15:35  帅胡  阅读(10719)  评论(1编辑  收藏  举报

导航