Spaces:
Runtime error
Runtime error
Download util/time.py from JR818/JarvisFastAPI: direct link, hf CLI and curl.
- Browser
- Download file 593 Bytes
-
https://huggingface.co/spaces/JR818/JarvisFastAPI/resolve/524fd18baf44cf2bf5561fa52a53279dc9a54fbd/util/time.py
- Command line
-
hf download hf://spaces/JR818/JarvisFastAPI@524fd18baf44cf2bf5561fa52a53279dc9a54fbd/util/time.py
-
curl -L -o time.py https://huggingface.co/spaces/JR818/JarvisFastAPI/resolve/524fd18baf44cf2bf5561fa52a53279dc9a54fbd/util/time.py
593 Bytes
| import pytz | |
| from datetime import datetime,timedelta | |
| class TimeUtil: | |
| def get_date(offset=None): | |
| beijing_tz = pytz.timezone('Asia/Shanghai') | |
| time = datetime.now(beijing_tz) | |
| if offset: | |
| time = time +timedelta(days=offset) | |
| format_date = time.strftime('%Y-%m-%d') | |
| return format_date | |
| def get_time(): | |
| beijing_tz = pytz.timezone('Asia/Shanghai') | |
| beijing_time = datetime.now(beijing_tz) | |
| format_time = beijing_time.strftime('%Y-%m-%d %H:%M:%S') | |
| return format_time | |