'PHP - changing time with php and tpl in CScart

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?



Solution 1:[1]

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'"}

Solution 2:[2]

Please try:

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcin Orlowski
Solution 2 Hungryweb