This repository has been archived on 2023-06-09. You can view files and clone it, but cannot push or open issues or pull requests.
jarvis-server/skills/daily/date_and_time/intent.py
2021-07-27 12:37:09 +02:00

31 lines
810 B
Python

import time
from datetime import datetime
from utils import config_utils, intents_utils
def what_time_is_it():
tag = 'what_time_is_it'
response = intents_utils.get_response(tag)
current_time = time.localtime()
if config_utils.get_in_config("12HOURS-FORMAT"):
response = response.replace('{time}', time.strftime("%I:%M %p", current_time))
else:
response = response.replace('{time}', time.strftime("%H:%M", current_time))
return response
def what_day_is_it():
tag = 'what_day_is_it'
response = intents_utils.get_response(tag)
day_number = datetime.today().weekday()
lang_json = intents_utils.get_lang_for_intent('what_day_is_it')['others']['days_of_week']
response = response.replace('{day}', lang_json[str(day_number)])
return response