/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
>>> import datetime >>> now = datetime.datetime(2003, 8, 4, 12, 30, 45) >>> print now 2003-08-04 12:30:45 >>> print repr(now) datetime.datetime(2003,8,4,12,30,45) >>> print type(now) <type 'instance'> >>> print now.year, now.month, now.day 2003 8 4 >>> print now.hour, now.minute, now.second 12 30 45
URL: http://snippets.dzone.com/posts/show/1614