本文整理汇总了Python中wikilife_utils.date_utils.DateUtils.get_datetime_local方法的典型用法代码示例。如果您正苦于以下问题:Python DateUtils.get_datetime_local方法的具体用法?Python DateUtils.get_datetime_local怎么用?Python DateUtils.get_datetime_local使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wikilife_utils.date_utils.DateUtils
的用法示例。
在下文中一共展示了DateUtils.get_datetime_local方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_to_datetime
# 需要导入模块: from wikilife_utils.date_utils import DateUtils [as 别名]
# 或者: from wikilife_utils.date_utils.DateUtils import get_datetime_local [as 别名]
def test_to_datetime(self):
tz_name = "US/Central"
dt = DateUtils.get_datetime_local(tz_name)
expected_str_value = "%s-%02d-%02d %02d:%02d:%02d %s" %(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, DateUtils.get_utc_offset_str(tz_name))
str_value = DateFormatter.to_datetime(dt)
print expected_str_value
print str_value
assert str_value != None
assert str_value == expected_str_value
示例2: test_get_datetime_local
# 需要导入模块: from wikilife_utils.date_utils import DateUtils [as 别名]
# 或者: from wikilife_utils.date_utils.DateUtils import get_datetime_local [as 别名]
def test_get_datetime_local(self):
tz_name = "US/Central"
utc_dt = DateUtils.get_datetime_utc()
local_dt = DateUtils.get_datetime_local(tz_name)
#assert local_dt.hour+5 == utc_dt.hour
assert local_dt.year == utc_dt.year
assert local_dt.month == utc_dt.month
assert local_dt.day == utc_dt.day
assert local_dt.minute == utc_dt.minute
assert local_dt.second == utc_dt.second
示例3: _add_single_log
# 需要导入模块: from wikilife_utils.date_utils import DateUtils [as 别名]
# 或者: from wikilife_utils.date_utils.DateUtils import get_datetime_local [as 别名]
def _add_single_log(self):
root_slug = "exercise"
nodes = [{"node_id": 298, "value": "60"}]
current_date_local = DateUtils.get_datetime_local("America/Argentina/Buenos_Aires")
execute_time = DateFormatter.to_datetime(current_date_local)
#create test log
logs = []
log = self._get_sample_log(TEST_USER_ID, root_slug, nodes, execute_time)
logs.append(log)
body = JSONParser.to_json(logs)
raw_response = self.rest_post("http://localhost:7080/2/logs/add", body)
print raw_response
response = JSONParser.to_collection(raw_response)
added_log_id = response["data"][0]
return added_log_id, execute_time