Date format

Permalink
Im sure someone has asked this before but can't find it.

Is there any code I can change in C5 that will let me display dates as d-m-y instead of m-d-y?

Cheers

Chris

senshidigital
 
pvernaglia replied on at Permalink Reply
pvernaglia
You can use the Date/Time Helper:

<?php
  $date = Loader::helper("date");
  echo $date->getLocalDateTime('now',$mask = 'd-m-Y')
?>


You can also define date and time in site.php to override defaults by changing the php date/time values in the statements, some of the ones you can change are:

define('DATE_APP_GENERIC_MDYT_FULL', t('F d, Y \a\t g:i A'));
define('DATE_APP_GENERIC_MDYT', t('n/j/Y \a\t g:i A'));
define('DATE_APP_GENERIC_MDY', t('n/j/Y'));
define('DATE_APP_GENERIC_MDY_FULL', t('F d, Y'));
define('DATE_FORM_HELPER_FORMAT_HOUR', '24');
senshidigital replied on at Permalink Reply
senshidigital
Thanks I will give one of them a go and let you know how I get on.
powerall replied on at Permalink Reply
If I put this code in site.php I can not see anymore the webite.
Rob7 replied on at Permalink Reply
I had the same. The site was OK once I removed the t() part in the statement, i.e.
define('DATE_APP_GENERIC_MDYT_FULL', 'F d, Y \a\t g:i A');


However, changing the format does not seem to be affecting the site so far. See also.

http://www.concrete5.org/community/forums/chat/change-to-european-d...

http://php.net/manual/en/function.date.php...