get second number from date-time

Get number of seconds from time

Download getsecondfromdate.zip

Synopsis:

getsecondfromdate.py


getsecondfromdate.py

Synopsis
def GetSecondFromDate(t):
  import time
  return time.localtime(t)[5]

#-- unit tests
def test_getsecondfromdate():
  ut.utassert(GetSecondFromDate(0), 0);
  ut.utassert(GetSecondFromDate(28799), 59);
  ut.utassert(GetSecondFromDate(28800), 0);  #28800 seconds is 8 hours
  ut.utassert(GetSecondFromDate(1056523422), 42);
  ut.utassert(GetSecondFromDate(1096523422), 22);






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