当前位置: 首页>>代码示例>>Python>>正文


Python DateUtils.get_datetime_local方法代码示例

本文整理汇总了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
开发者ID:wikilife-org,项目名称:wikilife_utils,代码行数:13,代码来源:date_formatter_tests.py

示例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
开发者ID:wikilife-org,项目名称:wikilife_utils,代码行数:14,代码来源:date_utils_tests.py

示例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
开发者ID:wikilife-org,项目名称:wikilife_ws,代码行数:20,代码来源:logs_edit_tests.py


注:本文中的wikilife_utils.date_utils.DateUtils.get_datetime_local方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。