CodeCharge Studio

CCFormatDate Function (PHP)

Description

Formats a date value according to the specified format mask.

Syntax

CCFormatDate(DateToFormat,FormatMask)

Example

CCFormatDate(CCParseDate("2002 May 1",array("yyyy"," ","mmm"," ","d")), array("LongDate")) -> "May 1, 2002"
CCFormatDate(CCParseDate("2002-05-01 20:12",
         array("yyyy", "-", "mm", "-", "dd", " ", "HH", ":", "nn")),
         array("mmm"," ","d",", time is ","hh",":","nn","","AM/PM")) -> "May 1, time is 8:12 PM"

Return value

None

Parameters

Name Type Description Required
DateToFormat Array The date value which will be formatted Yes
FormatMask Array of strings Each string is one of the following components (all other components are left unchanged when building formatted value):
dday
wweek
mmonth
qquarter
yday of the year
hhour in 12-hour format
Hhour in 24-hour format
nminute
ssecond
ddzero-filled day
wwweek of year
mmzero-filled month
yytwo-digit year
hhzero-filled hour in 12-hour format
HHzero-filled hour in 24-hour format
nnzero-filled minute
sszero-filled second
dddshort weekday name
mmmshort month name
A/PA or P according to AM/PM
a/pa or p according to AM/PM
ddddweekday name
mmmmmonth name
yyyyyear
AM/PMAM or PM
am/pmam or pm
LongDatelong date format
LongTimelong time format
ShortDateshort date format
ShortTimeshort time format
GeneralDategeneral date format
Yes


On-line, printable versions and updates