當前位置: 首頁>>代碼示例>>Python>>正文


Python DateTime.Time方法代碼示例

本文整理匯總了Python中mx.DateTime.Time方法的典型用法代碼示例。如果您正苦於以下問題:Python DateTime.Time方法的具體用法?Python DateTime.Time怎麽用?Python DateTime.Time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mx.DateTime的用法示例。


在下文中一共展示了DateTime.Time方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_parse_datetime_timezone

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def test_parse_datetime_timezone(self):
        # Time zone information is ignored.
        from mx.DateTime import DateTime
        expected = DateTime(2007, 1, 1, 13, 30, 29)
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29+01", self.curs))
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29-01", self.curs))
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29+01:15", self.curs))
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29-01:15", self.curs))
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29+01:15:42", self.curs))
        self.assertEqual(
            expected, self.DATETIME("2007-01-01 13:30:29-01:15:42", self.curs)) 
開發者ID:iwitaly,項目名稱:psycopg2-for-aws-lambda,代碼行數:18,代碼來源:test_dates.py

示例2: check_time_tz

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def check_time_tz(self, str_offset, offset):
        from datetime import time, timedelta
        base = time(13, 30, 29)
        base_str = '13:30:29'

        value = self.TIME(base_str + str_offset, self.curs)

        # Value has time zone info and correct UTC offset.
        self.assertNotEqual(value.tzinfo, None),
        self.assertEqual(value.utcoffset(), timedelta(seconds=offset))

        # Time portion is correct.
        self.assertEqual(value.replace(tzinfo=None), base) 
開發者ID:iwitaly,項目名稱:psycopg2-for-aws-lambda,代碼行數:15,代碼來源:test_dates.py

示例3: test_parse_time_timezone

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def test_parse_time_timezone(self):
        # Time zone information is ignored.
        from mx.DateTime import Time
        expected = Time(13, 30, 29)
        self.assertEqual(expected, self.TIME("13:30:29+01", self.curs))
        self.assertEqual(expected, self.TIME("13:30:29-01", self.curs))
        self.assertEqual(expected, self.TIME("13:30:29+01:15", self.curs))
        self.assertEqual(expected, self.TIME("13:30:29-01:15", self.curs))
        self.assertEqual(expected, self.TIME("13:30:29+01:15:42", self.curs))
        self.assertEqual(expected, self.TIME("13:30:29-01:15:42", self.curs)) 
開發者ID:iwitaly,項目名稱:psycopg2-for-aws-lambda,代碼行數:12,代碼來源:test_dates.py

示例4: test_adapt_time

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def test_adapt_time(self):
        from mx.DateTime import Time
        value = self.execute('select (%s)::time::text',
                             [Time(13, 30, 29)])
        self.assertEqual(value, '13:30:29') 
開發者ID:iwitaly,項目名稱:psycopg2-for-aws-lambda,代碼行數:7,代碼來源:test_dates.py

示例5: test_type_roundtrip_time

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def test_type_roundtrip_time(self):
        from mx.DateTime import Time
        self._test_type_roundtrip(Time(10, 20, 30)) 
開發者ID:iwitaly,項目名稱:psycopg2-for-aws-lambda,代碼行數:5,代碼來源:test_dates.py

示例6: test_type_roundtrip_time

# 需要導入模塊: from mx import DateTime [as 別名]
# 或者: from mx.DateTime import Time [as 別名]
def test_type_roundtrip_time(self):
        from mx.DateTime import Time
        self._test_type_roundtrip(Time(10,20,30)) 
開發者ID:fartashh,項目名稱:userbase-sns-lambda,代碼行數:5,代碼來源:test_dates.py


注:本文中的mx.DateTime.Time方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。