Util¶
Utility functions for Pact.
This module defines a number of utility functions that are used in specific contexts within the Pact library. These functions are not intended to be used directly by consumers of the library, but are still made available for reference.
Functions¶
strftime_to_simple_date_format(python_format: str) -> str
¶
Convert a Python datetime format string to Java SimpleDateFormat format.
Python uses strftime
codes
which are ultimately based on the C strftime
function. Java uses
SimpleDateFormat
codes
which generally have corresponding codes, but with some differences.
Note that this function strictly supports codes explicitly defined in the
Python documentation. Locale-dependent codes are not supported, and codes
supported by the underlying C library but not Python are not supported. For
examples, %c
, %x
, and %X
are not supported as they are locale
dependent, and %D
is not supported as it is not part of the Python
documentation (even though it may be supported by the underlying C and
therefore work in some Python implementations).
PARAMETER | DESCRIPTION |
---|---|
python_format
|
The Python datetime format string to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
str
|
The equivalent Java SimpleDateFormat format string. |