docs: now_datetime, get_timestamp
This commit is contained in:
parent
23b7f4c4ff
commit
4992bdf937
1 changed files with 4 additions and 2 deletions
|
|
@ -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())
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue