Please enable JavaScript to view this site.

Process Designer

Navigation: PHP API > Date and time zone

Formatted date (getFormattedDate)

Scroll Prev Top Next More

This function allows you to determine the date value in a specific format for an unformatted date value or UNIX time stamp.

Parameter

Type

Description

$id

int

Date format (possible values: 1 - 4)

$date

string | int

Date in the following format: YYYY-MM-DD HH:MM:SS or a UNIX time stamp (optional), in case false is passed, the current date is used

$isTimestamp

bool

Flag to show if the date is a UNIX timestamp (optional), default value is false

$fullDateTime

bool

Flag in order to set if only the date or date incl. time should be returned (optional), default value is false

$targetTimezone

string

Desired target time zone (optional). The allowed values are one of the time zones supported by PHP, e.g. Europe/Berlin or an offset value, e.g. +0200. The default value is an empty string (no time zone conversion). This argument is only considered if the module JobGlobaltime is licensed.

The function returns the date value or UNIX time stamp in the stated format.

Example:

$dateFormat = 1;

$unformattedDate = '2012-09-10 10:25:48';

$formattedDate = $this->getFormattedDate(1, $unformattedDate, false, true);

// $formattedDate = '10.09.2012 10:25:48'