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


Python Week.strftime方法代码示例

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


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

示例1: get_context_data

# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import strftime [as 别名]
    def get_context_data(self, **kwargs):
        semana = Semana.objects.get(id=self.kwargs['semana_id'])

        inicio = Week(semana.creacion.isocalendar()[0],semana.creacion.isocalendar()[1]+1).tuesday()
        fin = Week(semana.creacion.isocalendar()[0],semana.creacion.isocalendar()[1]+2).monday()

        kwargs['start_date'] = inicio.strftime("%Y-%m-%d")
        kwargs['end_date'] = fin.strftime("%Y-%m-%d")
        kwargs['formador'] = Formador.objects.get(id=self.kwargs['id']).get_full_name()
        kwargs['numero_semana'] = semana.numero
        return super(CronogramaFormadorUpdateView,self).get_context_data(**kwargs)
开发者ID:Dandresfs,项目名称:sican,代码行数:13,代码来源:views.py

示例2: decide_forecast_time

# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import strftime [as 别名]
def decide_forecast_time(timeby,value):
		
	if timeby == "Daily":
		d = "2014"+value[4:]
		start = parse(d)
		starti = (parse(d)-parse('2014-1-1')).days * 24
	
		end = parse(d)+timedelta(days=1)
		endi = starti + 24
		
	elif timeby == "Weekly":
		d = Week(2011, 40).monday()
		s = d.strftime("%Y-%m-%d")
		d = "2014"+s[4:]
		start = parse(d)
		starti = (parse(d)-parse('2014-1-1')).days * 24
		end = parse(d)+timedelta(days=7)
		endi = starti + (7*24)
	else:
		d = get_first_date(value)
		start = parse(d)
		starti = (parse(d)-parse('2014-1-1')).days * 24
		end = parse(d)+timedelta(days=30)
		endi = starti + (30*24)
		
	if end.year == 2015:
		end = parse("2014-12-31")
		endi = starti + ((end-parse(d)).days *24)
	
	return start,end,starti,endi
开发者ID:durgaravi,项目名称:non-intrusive-load-monitoring,代码行数:32,代码来源:timeseries.py

示例3: decide_time

# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import strftime [as 别名]
def decide_time(timeby,value):
	
	if timeby == "Daily":
		d = "2014"+value[4:]
		start = parse(d)-timedelta(days=3)
		
	elif timeby == "Weekly":
		d = Week(2011, 40).monday()
		s = d.strftime("%Y-%m-%d")
		d = "2014"+s[4:]
		start = parse(d)-timedelta(days=21)
	else:
		d = get_first_date(value)
		start = parse(d)-timedelta(days=90)
	if start.year == 2013:
		start = parse("2014-1-1")
	return start
开发者ID:durgaravi,项目名称:non-intrusive-load-monitoring,代码行数:19,代码来源:timeseries.py

示例4: trial_balance

# 需要导入模块: from isoweek import Week [as 别名]
# 或者: from isoweek.Week import strftime [as 别名]
def trial_balance(currency, groupby, period):
    if groupby == None:
        period = datetime.now()
        lastday = calendar.monthrange(period.year, period.month)[1]
        year = period.year
        month = period.month        
        period_beg = datetime(period.year, period.month, 1, 0, 0, 0, 0).strftime('%Y-%m-%d')
        period_end = datetime(period.year, period.month, lastday, 23, 59, 59, 999999).strftime('%Y-%m-%d')
        return redirect(
            url_for('bookkeeping.trial_balance',
            currency='Satoshis',
            groupby='Monthly',
            period='Current'))
            
    if groupby == 'Daily':
        periods = db.session \
            .query(\
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('month', models.LedgerEntries.date), \
                func.date_part('day', models.LedgerEntries.date)) \
            .order_by( \
                func.date_part('year', models.LedgerEntries.date).desc(), \
                func.date_part('month', models.LedgerEntries.date).desc(), \
                func.date_part('day', models.LedgerEntries.date).desc()) \
            .group_by( \
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('month', models.LedgerEntries.date), \
                func.date_part('day', models.LedgerEntries.date)) \
            .limit(7)

        periods = sorted([date(int(period[0]), int(period[1]), int(period[2])) for period in periods])
        if period == 'Current':
            period = periods[-1]
        else:
            period = datetime.strptime(period, "%Y-%m-%d")
        
        period_beg = datetime(period.year, period.month, period.day, 0, 0, 0, 0)
        period_end = datetime(period.year, period.month, period.day, 23, 59, 59, 999999)
        
        periods = sorted([period.strftime("%Y-%m-%d") for period in periods])
        period = period.strftime("%Y-%m-%d") 

    elif groupby == 'Weekly':
        periods = db.session \
            .query(\
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('week', models.LedgerEntries.date)) \
            .order_by( \
                func.date_part('year', models.LedgerEntries.date).desc(), \
                func.date_part('week', models.LedgerEntries.date).desc()) \
            .group_by( \
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('week', models.LedgerEntries.date)) \
            .limit(7)
        periods = sorted([Week(int(period[0]), int(period[1])).monday() for period in periods])
        
        if period == 'Current':
            period = periods[-1]
        else:
            period = period.split('-')
            period = Week(int(period[0]), int(period[1])+1).monday()
            
        period_beg = period - timedelta(days = period.weekday())
        period_end = period_beg + timedelta(days = 6)
        period_beg = datetime(period_beg.year, period_beg.month, period_beg.day, 0, 0, 0, 0)
        period_end = datetime(period_end.year, period_end.month, period_end.day, 23, 59, 59, 999999)
        periods = sorted([period.strftime("%Y-%W") for period in periods])
        period = period.strftime("%Y-%W") 

    elif groupby == 'Monthly':
        if period == 'Current':
            period = datetime.now()
        else:
            period = datetime.strptime(period, "%Y-%m")
        lastday = calendar.monthrange(period.year, period.month)[1]
        period_beg = datetime(period.year, period.month, 1, 0, 0, 0, 0)
        period_end = period = datetime(period.year, period.month, lastday, 23, 59, 59, 999999)

        periods = db.session \
            .query(\
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('month', models.LedgerEntries.date)) \
            .group_by( \
                func.date_part('year', models.LedgerEntries.date), \
                func.date_part('month', models.LedgerEntries.date)) \
            .all()
        periods = sorted([date(int(period[0]), int(period[1]), 1) for period in periods])
        periods = sorted([period.strftime("%Y-%m") for period in periods])
        period = period.strftime("%Y-%m")
        
    elif groupby == 'Annual':
        if period == 'Current':
            period = datetime.now()
        else:
            period = datetime.strptime(period, "%Y")
        period_beg = datetime(period.year, 1, 1, 0, 0, 0, 0)
        period_end = datetime(period.year, 12, 31, 23, 59, 59, 999999)
        
        periods = db.session \
            .query(func.date_part('year', models.LedgerEntries.date)) \
#.........这里部分代码省略.........
开发者ID:LainZWired,项目名称:pacioli,代码行数:103,代码来源:bookkeeping.py


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