Created
March 1, 2012 19:22
-
-
Save anonymous/1952454 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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