Gets the list of defined date formats and attributes.
$date_format_id: (optional) The date type name.
An associative array of date formats. The top-level keys are the machine-readable names of the date formats. The values are associative arrays with the following keys:
If $date_format_id was defined, only the date formats associated with the given machine name are returned, in an associative array keyed by format string.
function system_get_date_formats($date_format_id = NULL) {
$date_formats = config('system.date')
->get('formats');
// Return either the specific format or all formats.
return empty($date_format_id) ? $date_formats : $date_formats[$date_format_id];
}