本文整理匯總了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))
示例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)
示例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))
示例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')
示例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))
示例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))