Can format a string that contain a Date?

Hello Losant Team!

I have date as a string in a attribute of my device. I want that this appear as ‘dd-mm-yyyy’. I want to know if this possible with a date as a string.

The string looks like this
image

I want display it in a dashboard so i think that handlebars help, but i couldnt make it

I would recommend using the Indicator Block to achieve this. The Gauge Block is designed to display numerical data. The expression field supports math expressions like {{value}} / 1000. It’s not designed to reformat the value of string data.

The Indicator Block supports markdown and handlebar helpers. For this specific case, you’d use the formatDate helper:

{{formatDate value 'DD-MM-YYYY'}}

The format strings come from Moment.js.

Here’s an example using the Template Tester tool in the docs.

Screenshot of Indicator Block configuration:

1 Like

Thank you very much Brandon. Your solution works perfectly. :slight_smile: