show German date format

A collection of tutorials and posts that show additional functionality of MATE

Moderator: KarelB

show German date format

Postby Dietmar » Sun Oct 30, 2022 7:36 am

I added these lines to show and enter (add or edit) a date in German notation (dd.mm.yyyy):

$tableColumns['beginn'] = array(
'input_info' => 'size="10"',
'on_edit_fun' => array(&$this,'replaceGDate'),
'on_add_fun' => array(&$this,'replaceGDate'),
'edit_fun' => array(&$this,'replaceUDate'),
'display_mask' => 'date_format(beginn,"%d.%m.%Y")'
);

and before "protected initiateEditor()":

function replaceGDate($col,$val,$row,$instanceName)
{
if ( substr($val,2,1)=="." and substr($val,5,1)==".")
return substr($val,6,4)."-".substr($val,3,2)."-".substr($val,0,2);
else
return $val;
}
function replaceUDate($col,$val,$row,$instanceName)
{
return substr($val,8,2).".".substr($val,5,2).".".substr($val,0,4);
}
Dietmar
 
Posts: 4
Joined: Mon Mar 26, 2018 1:11 pm

Re: show German date format

Postby MikeW » Sat Nov 19, 2022 8:29 pm

try this:
Code: Select all
      $tableColumns['termin_1_von'] = array(
         'display_text' => 'Termin 1 von',
         'perms' => 'EVCAXQSFHO',
/*         'display_mask' => 'date_format(`date_published`,"%Y-%m-%d")',
         'order_mask'   => 'date_format(`date_published`,"%Y-%m-%d")',
         'range_mask'   => 'date_format(`date_published`,"%Y-%m-%d")', */
         'calendar' => array(
               'js_format' => 'dd.mm.yy',
               'options' => array('showButtonPanel' => true)
          )
      );

this shows at the input filed: 19.11.2022
MikeW
 
Posts: 26
Joined: Mon Oct 31, 2011 11:43 am


Return to How To

Who is online

Users browsing this forum: No registered users and 1 guest

cron