Example #1
0
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) + ')'
Example #2
0
def read_date(post):
    "post_date -> datetime.datetime"
    if post.date():
        return datetime.datetime.fromtimestamp(
                hkutils.calc_timestamp(post.date())
            )
    else:
        return None
Example #3
0
    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)
Example #4
0
 def test_calc_timestamp(self):
     ts = hkutils.calc_timestamp('Wed, 20 Aug 2008 17:41:30 +0200')
     self.assertEquals(ts, 1219246890.0)