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


Python DateTime.dow方法代码示例

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


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

示例1: get_birthdaysToday

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import dow [as 别名]
    def get_birthdaysToday(self, type_filter):
        results = []
        if type_filter == 1:
            date_start = date.today().strftime('%Y-%m-%d')
            date_end = date.today().strftime('%Y-%m-%d')

            results = ModelsDadosFuncdetails().get_FuncBirthdays(date_start,date_end)

        elif type_filter == 7:
            now = DateTime()
            dow = now.dow()
            date_start = (now - dow).strftime('%Y-%m-%d')
            date_end = (now - dow + 6).strftime('%Y-%m-%d')

            results = ModelsDadosFuncdetails().get_FuncBirthdays(date_start,date_end)

        elif type_filter == 30:
            now = DateTime()

            dia = calendar.monthrange(now.year(),now.month())[1]
            date_start = now.strftime('%Y-%m-1')
            date_end = now.strftime('%Y-%m-'+str(dia))

            results = ModelsDadosFuncdetails().get_FuncBirthdays(date_start,date_end)

        elif type_filter == 'prox':
            results = ModelsDadosFuncdetails().get_FuncBirthdays('','','proximo')

        if results:
            return results #results[:int(quant)]
        else:
            return []
开发者ID:vindula,项目名称:vindula.myvindula,代码行数:34,代码来源:myvindula.py

示例2: get_birthdaysToday

# 需要导入模块: from DateTime.DateTime import DateTime [as 别名]
# 或者: from DateTime.DateTime.DateTime import dow [as 别名]
    def get_birthdaysToday(self, type_filter, filtro_OU):
        Z_now = DateTime()
        today = DateTime().asdatetime().date()

        if type_filter == '1':
            date_start = date_end = today

        elif type_filter == '7':
            day_of_weekday = Z_now.dow()
#            date_start = (Z_now + 1 - day_of_weekday).asdatetime().date()
            #Pega os aniversariantes da semana a partir de HOJE!
            #Acho que nao faz sentido listar os que ja passaram
            date_start = today
            date_end = (Z_now + 1 - day_of_weekday + 6).asdatetime().date()

        elif type_filter == '30':
            last_dia = calendar.monthrange(today.year,today.month)[1]
            date_start = date(today.year,today.month,1)
            date_end = date(today.year,today.month,last_dia)

        elif type_filter == 'prox':
            date_start = today
            date_end = today + timedelta(days=365)
        
        results = FuncDetails.get_FuncBirthdays(date_start,date_end)

        if filtro_OU:
            if not isinstance(filtro_OU, str):
                filtro_OU = filtro_OU.UID()
                
            results_OU = []
            for user in results:
                unidade_user = user.get('UO','')          
                if filtro_OU == unidade_user:
                    results_OU.append(FuncDetails(user.get('username', '')))
            return results_OU
        
        return results
开发者ID:vindula,项目名称:vindula.tile,代码行数:40,代码来源:birthdays.py


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