MCPcopy Index your code
hub / github.com/python-pendulum/pendulum / from_format

Function from_format

src/pendulum/__init__.py:270–283  ·  view source on GitHub ↗

Creates a DateTime instance from a specific format.

(
    string: str,
    fmt: str,
    tz: str | Timezone = UTC,
    locale: str | None = None,
)

Source from the content-addressed store, hash-verified

268
269
270def from_format(
271 string: str,
272 fmt: str,
273 tz: str | Timezone = UTC,
274 locale: str | None = None,
275) -> DateTime:
276 """
277 Creates a DateTime instance from a specific format.
278 """
279 parts = _formatter.parse(string, fmt, now(tz=tz), locale=locale)
280 if parts["tz"] is None:
281 parts["tz"] = tz
282
283 return datetime(**parts)
284
285
286def from_timestamp(timestamp: int | float, tz: str | Timezone = UTC) -> DateTime:

Callers

nothing calls this directly

Calls 3

nowFunction · 0.85
datetimeFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…