FormatDate
string
FormatDate(
string format,
int timestamp,
int now = time(),
);
The function returns string, formatted in accordance with the specified format based on the time value, defined in the timestamp.
Note: in practice this function acts as wrapper for PHP function
Method parameters
Parameter | Description | Available from version | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
format | Data/time format. The following extensions are supported in addition to the standard symbols:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
timestamp | timestamp in Unix format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
now | timestamp in Unix format that is used to calculate intervals. By default - time(). |
Notes
The 'x' and 'X' formats supports future time specs. If the value of the timestamp parameter is higher than the value of the now parameter (i.e future time is specified), the formats "X" and "x" will return time in the site format without seconds.Returned value
Formatted string.
See Also
Examples of use
<?
$rsUser = CUser::GetList($by, $order, array(
"ID_EQUAL_EXACT" => $USER->GetID()
));
if($arUser = $rsUser->Fetch())
{
echo "Registered on site: ",FormatDate("Q", MakeTimeStamp($arUser["DATE_REGISTER"])),".";
}
?>
© «Bitrix24», 2001-2024