def format_date(post): "post -> str" if post.date() == '': return "(no date)" else: d = time.localtime(hkutils.calc_timestamp(post.date())) return "(" + time.strftime('%Y.%m.%d.', d) + ')'
def read_date(post): "post_date -> datetime.datetime" if post.date(): return datetime.datetime.fromtimestamp( hkutils.calc_timestamp(post.date()) ) else: return None
def test_calc_timestamp(self): """Tests :func:`hkutils.calc_timestamp`.""" ts = hkutils.calc_timestamp('Wed, 20 Aug 2008 17:41:30 +0200') self.assertEqual(ts, 1219246890.0)
def test_calc_timestamp(self): ts = hkutils.calc_timestamp('Wed, 20 Aug 2008 17:41:30 +0200') self.assertEquals(ts, 1219246890.0)