Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# -*- coding: utf-8 -*-
import datetime as dt_variation
from datetime import datetime
DELTA = dt_variation.timedelta(days=2)
DATAS = ('2012-02-08', '2012-02-09', '2012-02-10', '2012-02-11', '2012-02-12')
PONTO_MOVIMENTO = ''
def Gera_Data():
for i in DATAS:
if datetime.strptime(i, "%Y-%m-%d").isoweekday() == 6:
PONTO_MOVIMENTO = i
break
for i in DATAS:
if datetime.strptime(i, "%Y-%m-%d") >= datetime.strptime(PONTO_MOVIMENTO, "%Y-%m-%d"):
print "Incrementa 2 dias e grava no banco: " + str(datetime.strptime(i, "%Y-%m-%d") + DELTA)
else:
print "Não incrementa e grava no banco: " + str(datetime.strptime(i, "%Y-%m-%d"))
Gera_Data()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.