use timezone

This commit is contained in:
Mickael 2019-08-30 21:34:40 +02:00
parent 7b22c4d10d
commit 7190f7d0be

View file

@ -1,13 +1,14 @@
import os, json import os, json, pytz
from datetime import datetime, timedelta from datetime import datetime, timedelta
def main(): def main():
# I must add 2 hours on gitlab CI zone = ' '.join(pytz.country_timezones['fr'])
nowongitlab = datetime.now() + timedelta(hours=2) tz = pytz.timezone(zone)
now = datetime.now(tz)
info = { info = {
"lastupdate": datetime.strftime(nowongitlab, "%d/%m/%Y %X") "lastupdate": datetime.strftime(now, "%d/%m/%Y %X")
} }
save(info) save(info)