[code.view]

[top] / python / PyMOTW / datetime / datetime_comparing.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Comparing dates and times.
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import datetime
     import time
     
     print 'Times:'
     t1 = datetime.time(12, 55, 0)
     print '\tt1:', t1
     t2 = datetime.time(13, 5, 0)
     print '\tt2:', t2
     print '\tt1 < t2:', t1 < t2
     
     print 'Dates:'
     d1 = datetime.date.today()
     print '\td1:', d1
     d2 = datetime.date.today() + datetime.timedelta(days=1)
     print '\td2:', d2
     print '\td1 > d2:', d1 > d2
     

[top] / python / PyMOTW / datetime / datetime_comparing.py

contact | logmethods.com