Documentation

FormatDateFromDB

string
FormatDateFromDB (
 date,
 format = 'FULL',
 phpFormat = false
);

The function returns date in the language of site.

Function parameters

Parameter Description Available from version
date Date, specified in the site format
format Format to which the date must be converted.
  • FULL - full date format;
  • SHORT - short date format;
  • Explicit format indication, for example, MM/DD/YYYY. ([link=6658092]Formats[/link])
Optional parameter, "FULL" by default.
phpFormat Optional parameter.

Example of use

echo FormatDateFromDB('01/23/2013', 'DD MMMM YYYY'); // returns 23 Enero 2013, if the site language is Spanish
echo FormatDateFromDB('7 June 2012 12:00pm', 'SHORT'); // returns 7 June 2012, if the site language is Russian and short time format - DD MMMM YYYY
echo FormatDateFromDB('7 June 2012 12:00pm'); // returns 7 June 2012 12:00pm, if the language is Russian and full time format - DD MMMM YYYY G:MIT
echo FormatDateFromDB('7 June 2012 12:00pm', 'DD.MM'); // returns 07.06 for any language


© «Bitrix24», 2001-2022
Up