Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created June 10, 2018 00:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/36dcfc8549d57ca20597a122a060e809 to your computer and use it in GitHub Desktop.
Save Fhernd/36dcfc8549d57ca20597a122a060e809 to your computer and use it in GitHub Desktop.
Manipulación de fechas con zonas horarias. OrtizOL.
from datetime import datetime
from pytz import timezone
fecha = datetime(2013, 3, 14, 17, 23, 29)
print('Fecha base:', fecha)
bogota = timezone('America/Bogota')
bogota_fecha = bogota.localize(fecha)
print('Fecha Bogotá:', bogota_fecha)
singapur = timezone('Asia/Singapore')
singapur_fecha = bogota_fecha.astimezone(singapur)
print('Fecha Singapur:', singapur_fecha)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment