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


Python JS.getHours方法代码示例

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


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

示例1: __init__

# 需要导入模块: from __pyjamas__ import JS [as 别名]
# 或者: from __pyjamas__.JS import getHours [as 别名]
 def __init__(self, hour, minute=0, second=0, microsecond=0, tzinfo=None, d=None):
     if tzinfo != None:
         raise NotImplementedError("tzinfo")
     if d is None:
         d = JS("""new Date(1970, 1, 1, @{{hour}}, @{{minute}}, @{{second}}, 0.5 + @{{microsecond}} / 1000.0)""")
     self._d = d
     self.hour = d.getHours()
     self.minute = d.getMinutes()
     self.second = d.getSeconds()
     self.microsecond = d.getMilliseconds() * 1000.0
     self.tzinfo = None
开发者ID:simbha,项目名称:pyjamas,代码行数:13,代码来源:datetime.py

示例2: localtime

# 需要导入模块: from __pyjamas__ import JS [as 别名]
# 或者: from __pyjamas__.JS import getHours [as 别名]
def localtime(t=None):
    if t == None:
        t = time()
    date = JS("new Date(t*1000)")
    tm = struct_time()
    tm.tm_year = date.getFullYear()
    tm.tm_mon = date.getMonth() + 1
    tm.tm_mday = date.getDate()
    tm.tm_hour = date.getHours()
    tm.tm_min = date.getMinutes()
    tm.tm_sec = date.getSeconds()
    tm.tm_wday = (date.getDay() + 6) % 7
    startOfYear = int((JS("new Date(tm.tm_year,0,1)").getTime()) / 1000)
    tm.tm_yday = 1 + int((t - startOfYear) / 86400)
    tm.tm_isdst = date.getTimezoneOffset()
    return tm
开发者ID:andreyvit,项目名称:pyjamas,代码行数:18,代码来源:time.py

示例3: localtime

# 需要导入模块: from __pyjamas__ import JS [as 别名]
# 或者: from __pyjamas__.JS import getHours [as 别名]
def localtime(t=None):
    if t is None:
        t = time()
    date = JS("new Date(@{{t}}*1000)")
    dateOffset = date.getTimezoneOffset()
    tm = struct_time()
    tm_year = tm.tm_year = int(date.getFullYear())
    tm_mon = tm.tm_mon = int(date.getMonth()) + 1
    tm_mday = tm.tm_mday = int(date.getDate())
    tm.tm_hour = int(date.getHours())
    tm.tm_min = int(date.getMinutes())
    tm.tm_sec = int(date.getSeconds())
    tm.tm_wday = (int(date.getDay()) + 6) % 7
    tm.tm_isdst = 0 if timezone == 60*date.getTimezoneOffset() else 1
    startOfYear = JS("new Date(@{{tm_year}},0,1)") # local time
    startOfYearOffset = startOfYear.getTimezoneOffset()
    startOfDay = JS("new Date(@{{tm_year}},@{{tm_mon}}-1,@{{tm_mday}})")
    dt = float(startOfDay.getTime() - startOfYear.getTime())/1000
    dt = dt + 60 * (startOfYearOffset - dateOffset)
    tm.tm_yday = 1 + int(dt/86400.0)
    return tm
开发者ID:audreyr,项目名称:pyjs,代码行数:23,代码来源:time.py


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