Chat with us, powered by LiveChat
Home  /  Blog  /  News  /  Create a custom date format for the DateTime Joomla! Module

Create a custom date format for the DateTime Joomla! Module

Create a custom date format for the DateTime Joomla! Module

We’ve got many support tickets about how to add a custom date format in the DateTime Joomla! module. Below are three easy steps to create your own date format based in your Country.

For example, we want to display this date format “dddd, dd-mm-yyyy”, which is for Germany.

1. Open the file “/modules/mod_datetime/elements/dateformat.php”

FIND:

$date_formats_arr_a = array();

REPLACE WITH:

$date_formats_arr_a = array();
$date_formats_arr_a["dddd, dd-mm-yyyy"] = "dddd, dd-mm-yyyy (custom)";

2. Open the file “/modules/mod_datetime/helper.php”

FIND:

switch ($dateformat):

REPLACE WITH:

switch ($dateformat):
   case "dddd, dd-mm-yyyy":
   $date = $days[$day_of_the_week].", ".$d."-".$m."-".$year;
   break;

3. Save and upload the files. Then navigate to the module parameters and choose your new date format. Save the parameters, refresh your page, and now you have your custom date format using Web357’s DateTime Joomla! Module.

Custom date format - Screenshot from module parameters

Custom date format – Screenshot from module parameters

Leave a Reply

Your email address will not be published. Required fields are marked *

We are a young team of professionals and internet lovers who specialise in the development of professional websites and premium plugins for WordPress and Joomla! CMS.
Copyright © 2019 Web357. All Rights Reserved.
Joomla! ® name is used under a limited license from Open Source Matters in the United States and other countries.
Web357 is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.