Skip to content

Instantly share code, notes, and snippets.

@jllarena
jllarena / PST.py
Created October 21, 2021 02:40 — forked from vladwa/PST.py
Python snippet to get the PST time and date.
from datetime import datetime
from pytz import timezone
def get_pst_time():
date_format='%m_%d_%Y_%H_%M_%S_%Z'
date = datetime.now(tz=pytz.utc)
date = date.astimezone(timezone('US/Pacific'))
pstDateTime=date.strftime(date_format)
return pstDateTime