From 4992bdf93779723a128d1dadaa6a20c679483c8a Mon Sep 17 00:00:00 2001 From: Hussain Nagaria Date: Sat, 16 Dec 2023 23:05:46 +0530 Subject: [PATCH] docs: now_datetime, get_timestamp --- frappe/utils/data.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index f438602837..871a9ad5a1 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -328,12 +328,14 @@ def time_diff_in_hours( return round(float(time_diff(string_ed_date, string_st_date).total_seconds()) / 3600, 6) -def now_datetime(): +def now_datetime() -> datetime.datetime: + """Returns the current datetime in system timezone.""" dt = convert_utc_to_system_timezone(datetime.datetime.now(pytz.UTC)) return dt.replace(tzinfo=None) -def get_timestamp(date): +def get_timestamp(date: DateTimeLikeObject) -> float: + """Returns the Unix timestamp (seconds since Epoch) for the given `date`.""" return time.mktime(getdate(date).timetuple())