Using datetime in python 2.2 (e.g. pys60) [date] [python] [series60] [time] [datetime] [pys60] [compatible]


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. >>> import datetime
  2. >>> now = datetime.datetime(2003, 8, 4, 12, 30, 45)
  3. >>> print now
  4. 2003-08-04 12:30:45
  5. >>> print repr(now)
  6. datetime.datetime(2003,8,4,12,30,45)
  7. >>> print type(now)
  8. <type 'instance'>
  9. >>> print now.year, now.month, now.day
  10. 2003 8 4
  11. >>> print now.hour, now.minute, now.second
  12. 12 30 45

URL: http://snippets.dzone.com/posts/show/1614

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.