Date.format

Syntax

PP.Date.format(date, format): String;

Parameters

date. Date. Date.

format. String | PP.Date.Pattern. The format, to which the date should be converted.

Description

The formatstatic method returns formatted date.

Comments

The method returns an object of the String type.

Example

To execute the example, add a link to PP.js scenario file to HTML page.

// Create the current date
date = new Date();
// Set date format
format = PP.Date.Pattern.ShortDate;
// Get date in the short date format
newDate = PP.Date.format(date, format);
console.log(newDate);

After executing the example the date is presented in the short format.

See also:

PP