[code.view]

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

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """
     """
     
     __version__ = "$Id$"
     #end_pymotw_header
     
     import datetime
     
     format = "%a %b %d %H:%M:%S %Y"
     
     today = datetime.datetime.today()
     print 'ISO     :', today
     
     s = today.strftime(format)
     print 'strftime:', s
     
     d = datetime.datetime.strptime(s, format)
     print 'strptime:', d.strftime(format)
     

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

contact | logmethods.com