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


Python datetime.minute方法代码示例

本文整理汇总了Python中datetime.minute方法的典型用法代码示例。如果您正苦于以下问题:Python datetime.minute方法的具体用法?Python datetime.minute怎么用?Python datetime.minute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在datetime的用法示例。


在下文中一共展示了datetime.minute方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: register

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def register(context):
    functions = (
        build_datetime, build_timespan, datetime_from_timestamp,
        datetime_from_string, now, localtz, utctz, utc,
        days, hours, minutes, seconds, milliseconds, microseconds,
        datetime_plus_timespan, timespan_plus_datetime,
        datetime_minus_timespan, datetime_minus_datetime,
        timespan_plus_timespan, timespan_minus_timespan,
        datetime_gt_datetime, datetime_gte_datetime,
        datetime_lt_datetime, datetime_lte_datetime,
        timespan_gt_timespan, timespan_gte_timespan,
        timespan_lt_timespan, timespan_lte_timespan,
        negative_timespan, positive_timespan,
        timespan_by_num, num_by_timespan, div_timespans, div_timespan_by_num,
        year, month, day, hour, minute, second, microsecond, weekday,
        offset, timestamp, date, time, replace, format_, is_datetime,
        is_timespan
    )

    for func in functions:
        context.register_function(func) 
开发者ID:openstack,项目名称:yaql,代码行数:23,代码来源:date_time.py

示例2: _parse_datetime

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def _parse_datetime(self, dstr):
        # ' MM/DD  HH:MM:SS' or 'MM/DD  HH:MM:SS'
        # Dirty hack
        if dstr[0] != ' ':
            dstr = ' ' + dstr
        #year = 2017
        year = 2013 # for CHICAGO_IL_USA TMY2-94846
        month = int(dstr[1:3])
        day = int(dstr[4:6])
        hour = int(dstr[8:10])
        minute = int(dstr[11:13])
        sec = 0
        msec = 0
        if hour == 24:
            hour = 0
            dt = datetime(year, month, day, hour, minute, sec, msec) + timedelta(days=1)
        else:
            dt = datetime(year, month, day, hour, minute, sec, msec)
        return dt

    # Convert list of date/time string to list of datetime objects 
开发者ID:IBM,项目名称:rl-testbed-for-energyplus,代码行数:23,代码来源:energyplus_model.py

示例3: _convert_datetime24

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def _convert_datetime24(self, dates):
        # ' MM/DD  HH:MM:SS'
        dates_new = []
        for d in dates:
            #year = 2017
            #month = int(d[1:3])
            #day = int(d[4:6])
            #hour = int(d[8:10])
            #minute = int(d[11:13])
            #sec = 0
            #msec = 0
            #if hour == 24:
            #    hour = 0
            #    d_new = datetime(year, month, day, hour, minute, sec, msec) + dt.timedelta(days=1)
            #else:
            #    d_new = datetime(year, month, day, hour, minute, sec, msec)
            #dates_new.append(d_new)
            dates_new.append(self._parse_datetime(d))
        return dates_new

    # Generate x_pos and x_labels 
开发者ID:IBM,项目名称:rl-testbed-for-energyplus,代码行数:23,代码来源:energyplus_model.py

示例4: test_julian_day_dt

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def test_julian_day_dt(self):
        # add 1us manually to the test timestamp (GH #940)
        dt = times.tz_convert('UTC')[0] + pd.Timedelta(1, unit='us')
        year = dt.year
        month = dt.month
        day = dt.day
        hour = dt.hour
        minute = dt.minute
        second = dt.second
        microsecond = dt.microsecond
        assert_almost_equal(JD + 1e-6 / (3600*24),  # modify expected JD by 1us
                            self.spa.julian_day_dt(
                                year, month, day, hour,
                                minute, second, microsecond), 6) 
开发者ID:pvlib,项目名称:pvlib-python,代码行数:16,代码来源:test_spa.py

示例5: build_datetime

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def build_datetime(year, month, day, hour=0, minute=0, second=0,
                   microsecond=0, offset=ZERO_TIMESPAN):
    """:yaql:datetime

    Returns datetime object built on year, month, day, hour, minute, second,
    microsecond, offset.

    :signature: datetime(year, month, day, hour => 0, minute => 0, second => 0,
                         microsecond => 0, offset => timespan(0))
    :arg year: number of years in datetime
    :argType year: integer between 1 and 9999 inclusive
    :arg month: number of months in datetime
    :argType month: integer between 1 and 12 inclusive
    :arg day: number of days in datetime
    :argType day: integer between 1 and number of days in given month
    :arg hour: number of hours in datetime, 0 by default
    :argType hour: integer between 0 and 23 inclusive
    :arg minute: number of minutes in datetime, 0 by default
    :argType minute: integer between 0 and 59 inclusive
    :arg second: number of seconds in datetime, 0 by default
    :argType second: integer between 0 and 59 inclusive
    :arg microsecond: number of microseconds in datetime, 0 by default
    :argType microsecond: integer between 0 and 1000000-1
    :arg offset: datetime offset in microsecond resolution, needed for tzinfo,
        timespan(0) by default
    :argType offset: timespan type
    :returnType: datetime object

    .. code::

        yaql> let(datetime(2015, 9, 29)) -> [$.year, $.month, $.day]
        [2015, 9, 29]
    """
    zone = _get_tz(offset)
    return DATETIME_TYPE(year, month, day, hour, minute, second,
                         microsecond, zone) 
开发者ID:openstack,项目名称:yaql,代码行数:38,代码来源:date_time.py

示例6: minute

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def minute(dt):
    """:yaql:property minute

    Returns minutes of given datetime.

    :signature: datetime.minute
    :returnType: integer

    .. code::

        yaql> datetime(2006, 11, 21, 16, 30).minute
        30
    """
    return dt.minute 
开发者ID:openstack,项目名称:yaql,代码行数:16,代码来源:date_time.py

示例7: second

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def second(dt):
    """:yaql:property minute

    Returns seconds of given datetime.

    :signature: datetime.second
    :returnType: integer

    .. code::

        yaql> datetime(2006, 11, 21, 16, 30, 2).second
        2
    """
    return dt.second 
开发者ID:openstack,项目名称:yaql,代码行数:16,代码来源:date_time.py

示例8: convert_time_to_int

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def convert_time_to_int(datetime):
    return datetime.hour * 3600000 + datetime.minute * 60000 + datetime.second * 1000 + datetime.microsecond / 1000.0

# Convert the decision taken by an AI into an actual new location 
开发者ID:vgripon,项目名称:PyRat,代码行数:6,代码来源:pyrat.py

示例9: test_julian_day_dt

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def test_julian_day_dt(self):
        dt = times.tz_convert('UTC')[0]
        year = dt.year
        month = dt.month
        day = dt.day
        hour = dt.hour
        minute = dt.minute
        second = dt.second
        microsecond = dt.microsecond
        assert_almost_equal(JD,
                             self.spa.julian_day_dt(year, month, day, hour,
                                           minute, second, microsecond), 6) 
开发者ID:CalebBell,项目名称:fluids,代码行数:14,代码来源:test_spa.py

示例10: generate_x_pos_x_labels

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def generate_x_pos_x_labels(self, dates):
        time_delta  = self._parse_datetime(dates[1]) - self._parse_datetime(dates[0])
        x_pos = []
        x_labels = []
        for i, d in enumerate(dates):
            dt = self._parse_datetime(d) - time_delta
            if dt.hour == 0 and dt.minute == 0:
                x_pos.append(i)
                x_labels.append(dt.strftime('%m/%d'))
        return x_pos, x_labels 
开发者ID:IBM,项目名称:rl-testbed-for-energyplus,代码行数:12,代码来源:energyplus_model.py

示例11: replace

# 需要导入模块: import datetime [as 别名]
# 或者: from datetime import minute [as 别名]
def replace(dt, year=None, month=None, day=None, hour=None, minute=None,
            second=None, microsecond=None, offset=None):
    """:yaql:replace

    Returns datetime object with applied replacements.

    :signature: dt.replace(year => null, month => null, day => null,
                           hour => null, minute => null, second => null,
                           microsecond => null, offset => null)
    :receiverArg dt: input datetime object
    :argType dt: datetime object
    :arg year: number of years to replace, null by default which means
        no replacement
    :argType year: integer between 1 and 9999 inclusive
    :arg month: number of months to replace, null by default which means
        no replacement
    :argType month: integer between 1 and 12 inclusive
    :arg day: number of days to replace, null by default which means
        no replacement
    :argType day: integer between 1 and number of days in given month
    :arg hour: number of hours to replace, null by default which means
        no replacement
    :argType hour: integer between 0 and 23 inclusive
    :arg minute: number of minutes to replace, null by default which means
        no replacement
    :argType minute: integer between 0 and 59 inclusive
    :arg second: number of seconds to replace, null by default which means
        no replacement
    :argType second: integer between 0 and 59 inclusive
    :arg microsecond: number of microseconds to replace, null by default
        which means no replacement
    :argType microsecond: integer between 0 and 1000000-1
    :arg offset: datetime offset in microsecond resolution to replace, null
        by default which means no replacement
    :argType offset: timespan type
    :returnType: datetime object

    .. code::

        yaql> datetime(2015, 9, 29).replace(year => 2014).year
        2014
    """
    replacements = {}
    if year is not None:
        replacements['year'] = year
    if month is not None:
        replacements['month'] = month
    if day is not None:
        replacements['day'] = day
    if hour is not None:
        replacements['hour'] = hour
    if minute is not None:
        replacements['minute'] = minute
    if second is not None:
        replacements['second'] = second
    if microsecond is not None:
        replacements['microsecond'] = microsecond
    if offset is not None:
        replacements['tzinfo'] = _get_tz(offset)

    return dt.replace(**replacements) 
开发者ID:openstack,项目名称:yaql,代码行数:63,代码来源:date_time.py


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