phpdftk API Documentation

PdfDate
in package

FinalYes

PDF date string helper — ISO 32000-2 §7.9.4.

PDF dates are encoded as D:YYYYMMDDHHmmSSOHH'mm, where O is +, -, or Z. Producing and consuming these strings by hand is error-prone; this helper wraps PHP's DateTimeInterface.

Table of Contents

Methods

fromDateTime()  : PdfString
Format a PHP DateTime as a PDF date string and return it wrapped in a PdfString.
parse()  : DateTimeImmutable|null
Parse a PDF date string back into a DateTimeImmutable. Returns null on unparseable input.

Methods

fromDateTime()

Format a PHP DateTime as a PDF date string and return it wrapped in a PdfString.

public static fromDateTime(DateTimeInterface $dt) : PdfString
Parameters
$dt : DateTimeInterface
Return values
PdfString

parse()

Parse a PDF date string back into a DateTimeImmutable. Returns null on unparseable input.

public static parse(string $pdfDate) : DateTimeImmutable|null
Parameters
$pdfDate : string
Return values
DateTimeImmutable|null

        
On this page

Search results