Get month number from date
Download getmonthfromdate.zip
Synopsis: |
| getmonthfromdate.py |
| ||
#returns 1..12 def GetMonthFromDate(t): import time return (time.localtime(t))[1] #-- unit tests def test_getmonthfromdate(): ut.utassert(GetMonthFromDate(0), 12) ut.utassert(GetMonthFromDate(28799), 12) ut.utassert(GetMonthFromDate(28800), 1) #28800 seconds is 8 hours ut.utassert(GetMonthFromDate(1056523422), 6) ut.utassert(GetMonthFromDate(1096523422), 9) |
| Contact me about content on this page using john_web-at-arrizza-dot-com |
| For Web Master or site problems contact: webadmin-at-arrizza-dot-com |
| Copyright John Arrizza (c) 2001-2010 |