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):
d | day
| w | week |
m | month |
q | quarter |
y | day of the year |
h | hour in 12-hour format |
H | hour in 24-hour format |
n | minute |
s | second |
dd | zero-filled day |
ww | week of year |
mm | zero-filled month |
yy | two-digit year |
hh | zero-filled hour in 12-hour format |
HH | zero-filled hour in 24-hour format |
nn | zero-filled minute |
ss | zero-filled second |
ddd | short weekday name |
mmm | short month name |
A/P | A or P according to AM/PM |
a/p | a or p according to AM/PM |
dddd | weekday name |
mmmm | month name |
yyyy | year |
AM/PM | AM or PM |
am/pm | am or pm |
LongDate | long date format |
LongTime | long time format |
ShortDate | short date format |
ShortTime | short time format |
GeneralDate | general date format |
|
Yes |
On-line, printable versions and updates