to_date_time method

to_date_time

Converts the metadata signature value to a datetime.

If the metadata value cannot be converted, an exception is raised. When the original value is string‑based, the default culture from SignatureSettings.default_culture is used for conversion.

def to_date_time(self):
    ...

Returns: datetime: The metadata signature value as a datetime.

Example

from groupdocs.signature import Signature
from groupdocs.signature.options import MetadataSearchOptions

with Signature("signed.pdf") as signature:
    result = signature.search([MetadataSearchOptions()])
    for metadata in result.signatures:
        try:
            dt = metadata.to_date_time()
            print(f"{metadata.name} as datetime: {dt}")
        except Exception as e:
            print(f"Could not convert {metadata.name} to datetime: {e}")

to_date_time

Converts the metadata signature value to a datetime.

def to_date_time(self, provider):
    ...
Parameter Type Description
provider System.IFormatProvider Format data provider to use with data conversion operations.

Returns: datetime.datetime: The metadata signature value as a datetime.

Throws an exception if the metadata value could not be converted.

See Also