MCPcopy Create free account
hub / github.com/Freedium-cfd/web / convert_datetime_to_human_readable

Function convert_datetime_to_human_readable

medium-parser/medium_parser/time.py:4–35  ·  view source on GitHub ↗

Converts a datetime object to a human-readable format. Args: unix_time: The datetime object to convert. Returns: A human-readable string representing the datetime object.

(unix_time: int)

Source from the content-addressed store, hash-verified

2
3
4def convert_datetime_to_human_readable(unix_time: int):
5 """Converts a datetime object to a human-readable format.
6
7 Args:
8 unix_time: The datetime object to convert.
9
10 Returns:
11 A human-readable string representing the datetime object.
12 """
13 datetime_object = datetime.fromtimestamp(unix_time / 1000)
14
15 month_names = [
16 "January",
17 "February",
18 "March",
19 "April",
20 "May",
21 "June",
22 "July",
23 "August",
24 "September",
25 "October",
26 "November",
27 "December",
28 ]
29 day = datetime_object.day
30 month = month_names[datetime_object.month - 1]
31 year = datetime_object.year
32
33 human_readable_string = f"{month} {day}, {year}"
34
35 return human_readable_string
36
37
38def get_unix_ms() -> int:

Callers 1

generate_metadataMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected