The DateFormat class allows you to format dates and times with predefined styles in a locale-sensitive manner. Formatting times with the DateFormat class is similar to formatting dates.
Formatting dates with the DateFormat class is a two-step process. First, you create a formatter with the getDateInstance method. Second, you invoke the format method, which returns a string containing the formatted date.
DateTime values are formatted using standard or custom patterns stored in the properties of a DateTimeFormatInfo.
"E" will return integer 0 (for Sunday) through 6 (for Saturday). "EE" will return the narrow day of the week, e.g. "M" "EEE" will return the abrreviated day of the week, e.g. "Mon" "EEEE" will return the day of the week, e.g. "Monday"
"M" will return integer 1 through 12 "MM" will return the narrow month name, e.g. "J" "MMM" will return the abrreviated month name, e.g. "Jan" "MMMM" will return the month name, e.g. "January"
Get the pattern from DateTimeFormatInfo or some predefined patterns.
If the $pattern parameter is an array of 2 element, it will assume that the first element is the date, and second the time and try to find an appropriate pattern and apply DateTimeFormatInfo::formatDateTime See the tutorial documentation for futher details on the patterns.