Skip to content

Instantly share code, notes, and snippets.

@truongngoclinh
Last active October 2, 2017 09:36
Show Gist options
  • Save truongngoclinh/f19089ce1d69e1631b91c3c4f9f62704 to your computer and use it in GitHub Desktop.
Save truongngoclinh/f19089ce1d69e1631b91c3c4f9f62704 to your computer and use it in GitHub Desktop.
class TZUtils:
def is_maintainance_time(self):
local_tz = timezone.get_current_timezone()
now = timezone.localtime(timezone.now()).time()
start = timezone.localtime(local_tz.localize(timezone.datetime.strptime('16:00', '%H:%M'))).time()
end = timezone.localtime(local_tz.localize(timezone.datetime.strptime('17:00', '%H:%M'))).time()
logger.info("is_maintainance_time: start - end - now: %s - %s - %s ", start, end, now)
if "BankName" == models.BankTokenization.BANKS_LIST[self.api_req.bank_id]:
return now < start or now > end
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment