MCPcopy Index your code
hub / github.com/plotly/plotly.py / _datetime_str_to_ms

Function _datetime_str_to_ms

plotly/shapeannotation.py:17–22  ·  view source on GitHub ↗

Convert a datetime string to milliseconds since epoch.

(val)

Source from the content-addressed store, hash-verified

15
16
17def _datetime_str_to_ms(val):
18 """Convert a datetime string to milliseconds since epoch."""
19 dt = datetime.datetime.fromisoformat(val.replace("Z", "+00:00"))
20 if dt.tzinfo is None:
21 dt = dt.replace(tzinfo=datetime.timezone.utc)
22 return dt.timestamp() * 1000
23
24
25def _ms_to_datetime_str(ms):

Callers 1

_meanFunction · 0.85

Calls 1

replaceMethod · 0.45

Tested by

no test coverage detected