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


Python DateTime.millis方法代码示例

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


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

示例1: _convertDateTime

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import millis [as 别名]
 def _convertDateTime( self, value ):
     if value is None:
         return value
     if type( value ) == type( '' ):
         dt_obj = DateTime( value )
         value = dt_obj.millis() / 1000 / 60 # flatten to minutes
     if isinstance( value, DateTime ):
         value = value.millis() / 1000 / 60 # flatten to minutes
     return int( value )
开发者ID:OS2World,项目名称:APP-SERVER-Zope,代码行数:11,代码来源:DateRangeIndex.py

示例2: _convertDateTime

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import millis [as 别名]
 def _convertDateTime( self, value ):
     if value is None:
         return value
     if type( value ) == type( '' ):
         dt_obj = DateTime( value )
         value = dt_obj.millis() / 1000 / 60 # flatten to minutes
     if isinstance( value, DateTime ):
         value = value.millis() / 1000 / 60 # flatten to minutes
     result = int( value )
     if isinstance(result, long): # this won't work (Python 2.3)
         raise OverflowError( '%s is not within the range of dates allowed'
                           'by a DateRangeIndex' % value)
     return result
开发者ID:wpjunior,项目名称:proled,代码行数:15,代码来源:DateRangeIndex.py

示例3: _convertDateTime

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import millis [as 别名]
 def _convertDateTime(self, value):
     if value is None:
         return value
     if isinstance(value, (str, datetime)):
         dt_obj = DateTime(value)
         value = dt_obj.millis() / 1000 / 60  # flatten to minutes
     elif isinstance(value, DateTime):
         value = value.millis() / 1000 / 60  # flatten to minutes
     if value > MAX32 or value < -MAX32:
         # t_val must be integer fitting in the 32bit range
         raise OverflowError("%s is not within the range of dates allowed" "by a DateRangeIndex" % value)
     value = int(value)
     # handle values outside our specified range
     if value > self.ceiling_value:
         return None
     elif value < self.floor_value:
         return None
     return value
开发者ID:khink,项目名称:Products.ZCatalog,代码行数:20,代码来源:DateRangeIndex.py

示例4: datetime_to_minutes

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import millis [as 别名]
def datetime_to_minutes(value, precision=1,
                        max_value=MAX32, min_value=-MAX32):
    if value is None:
        return value

    if isinstance(value, (str, datetime)):
        value = DateTime(value)

    if isinstance(value, DateTime):
        value = value.millis() / 1000 / 60  # flatten to minutes

    # flatten to precision
    if precision > 1:
        value = value - (value % precision)

    value = int(value)

    if value > max_value or value < min_value:
        # value must be integer fitting in the range (default 32bit)
        raise OverflowError(
            '{0} is not within the range of dates allowed.'.format(value))

    return value
开发者ID:zopefoundation,项目名称:Products.ZCatalog,代码行数:25,代码来源:util.py


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