Skip to content

Instantly share code, notes, and snippets.

View choww's full-sized avatar

Carmen choww

View GitHub Profile
@choww
choww / dates.py
Last active July 1, 2023 21:40
Working with Dates in Python
from datetime import datetime, date, timedelta, timezone, timestamp
# create today's date that's offset-aware--datetime.today() seems to do the same thing
now = datetime.now(timezone.utc)
# convert datetime object to formatted string
today = now.strftime('%Y/%m/%d')
# calling `.astimezone()` without a timezone object defaults to the local timezone
pdt = now.astimezone()
# turn date string into timestamp
@choww
choww / keybase.md
Created August 10, 2018 17:10
keybase proof

Keybase proof

I hereby claim:

  • I am choww on github.
  • I am choww (https://keybase.io/choww) on keybase.
  • I have a public key ASBEeNvWMc5U3J6OvDMSBnUeD28AMVgThOef43J_FnV_hAo

To claim this, I am signing this object: