FoxitPDFSDKforWeb v11.0.1
Foxit PDF SDK for Web
PDFDate Class Reference

Represents a date and time in the PDF format. The following table lists the available pattern components for formatting and parsing dates: More...

Public Member Functions

 format (pattern:string)
 Format this PDFDate object according to the specified pattern. More...
 
 getDate ()
 Retrives the JS Date object representing the date and time stored in this PDFDate object. More...
 

Static Public Member Functions

static from (jsDate:Date)
 Creates a PDFDate instance from a JavaScript Date object. More...
 
static now ()
 Returns a new PDFDate instance representing the current date and time. More...
 
static parse (str:string, pattern:string)
 Parses a string according to the specified pattern and returns a PDFDate instance representing the parsed date and time. More...
 

Detailed Description

Represents a date and time in the PDF format. The following table lists the available pattern components for formatting and parsing dates:

Pattern Description
yyyy Full year (e.g., 2024)
yy Abbreviated year (e.g., 24 for 2024)
mmmm Full month name (e.g., January, February)
mmm Abbreviated month name (e.g., Jan, Feb, Mar)
mm Two-digit month (e.g., 01, 12)
m One or two-digit month (e.g., 1, 9, 10)
dddd Full day of the week (e.g., Sunday, Monday)
ddd

Abbreviated day of the week (e.g., Sun, Mon)

dd

Two-digit day of the month (e.g., 01, 29)

d

One or two-digit day of the month (e.g., 1, 9, 10)

HH

Two-digit hour (24-hour clock, e.g., 00, 23)

H

One or two-digit hour (24-hour clock, e.g., 01, 09, 18)

hh

Two-digit hour (12-hour clock, e.g., 00, 11, 06)

h

One or two-digit hour (12-hour clock, e.g., 1, 9, 6)

MM

Two-digit minute (e.g., 01, 59)

M

One or two-digit minute (e.g., 1, 59)

ss

Two-digit second (e.g., 01, 59)

s

One or two-digit second (e.g., 1, 59)

tt AM/PM (e.g., AM, PM)
t a/p (e.g., a, p)
Since
11.0.0

Member Function Documentation

◆ format()

PDFDate::format (   pattern:string)
inline

Format this PDFDate object according to the specified pattern.

Parameters
patternstring - The pattern to format this PDFDate object.
Returns
string - A string formatted according to the specified pattern.
Since
11.0.0

◆ from()

static PDFDate::from (   jsDate:Date)
inlinestatic

Creates a PDFDate instance from a JavaScript Date object.

Parameters
jsDateDate - The JavaScript Date object to be converted to a PDFDate.
Returns
PDFDate - A new PDFDate instance representing the same date and time.
Since
11.0.0

◆ getDate()

PDFDate::getDate ( )
inline

Retrives the JS Date object representing the date and time stored in this PDFDate object.

Returns
Date - A JS Date object representing the date and time stored in this PDFDate object.
Since
11.0.0

◆ now()

static PDFDate::now ( )
inlinestatic

Returns a new PDFDate instance representing the current date and time.

Returns
PDFDate - A new PDFDate instance representing the current date and time.
Since
11.0.0

◆ parse()

static PDFDate::parse (   str:string,
  pattern:string 
)
inlinestatic

Parses a string according to the specified pattern and returns a PDFDate instance representing the parsed date and time.

Parameters
strstring - The string to be parsed.
patternstring - The pattern to parse the string. The pattern can be a subset of the ICU date and time format.
Returns
PDFDate - A new PDFDate instance representing the parsed date and time.
Since
11.0.0

Foxit Software Corporation Logo
@2025 Foxit Software Incorporated. All rights reserved.