2.1.20 reference_data_tags
This commit is contained in:
11
BaseModels/datetime_funcs.py
Normal file
11
BaseModels/datetime_funcs.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from datetime import datetime
|
||||
import pytz
|
||||
|
||||
def get_cur_DT_by_timezone(timezone, DT=None):
|
||||
if not DT:
|
||||
DT = datetime.now()
|
||||
|
||||
if not timezone:
|
||||
return DT
|
||||
|
||||
return DT.astimezone(tz=pytz.timezone(timezone))
|
||||
Reference in New Issue
Block a user