Home > database >  PHP - changing time with php and tpl in CScart
PHP - changing time with php and tpl in CScart

Time:04-12

In my CScart application I use .tpl template file to dipslay some input data.

In the application settings, there is a default format for displaying it like '%H:%M' which I do not want to change. I want to force it just in one view to view seconds.

But as I am pretty new with CScart and .tpl files, this is line:

{$log.timestamp|date_format:"`$settings.Appearance.date_format`, `$settings.Appearance.time_format`"}

Which is displaying: 11/04/2022, 21.38

I want it to be displayed with seconds.. Reference: https://currentmillis.com/

Tried of replacing second part of the code with: date('h:i:s');, but no success.

Can someone help, what is the proper way of doing this?

CodePudding user response:

I'm not 100% sure, but it seems like this is actually using php date_format to display the time. I would, replace "$settings.Appearance.time_format" with something like "H:i:s".

Why don't you try this line, and see what happens

{$log.timestamp|date_format:"`$settings.Appearance.date_format`, 'H:i:s'"}

CodePudding user response:

Please try:

{$log.timestamp|date_format:"`$settings.Appearance.date_format`, %I:%M:%S"}
  • Related