# Date formatting

**URL:** https://discourse.nodered.org/t/date-formatting/36057
**Category:** Dashboard
**Created:** [17 November 2020 12:17 UTC](https://discourse.nodered.org/t/date-formatting/36057 "2020-11-17T12:17:22Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 12:17 UTC](https://discourse.nodered.org/t/date-formatting/36057/1 "2020-11-17T12:17:22Z")

</div>

Hello guys.  
I'm new to the red node and needed some help. I created the two flows below and created a table in the red node with SQLite to store my values away and I can't format the timestamp for a value with dd.hh.mm.ss. Can someone give me a hand?  
 ![1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/f/6f70cb97ba162cde2f0e3586d4094608c97b4377.png)

 ![2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/b/1b0535f465537ee8c2e910cfde57b5691a52f1a6.png)

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [17 November 2020 12:37 UTC](https://discourse.nodered.org/t/date-formatting/36057/2 "2020-11-17T12:37:32Z")

</div>

Hi, welcome to the forum!

Are you wanting to create a timestamp from scratch, for example the time now, or...

...do you have a timestamp already whose format needs changing to dd.hh.mm.ss?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 November 2020 13:33 UTC](https://discourse.nodered.org/t/date-formatting/36057/3 "2020-11-17T13:33:43Z")

</div>

If you want to store the current time in the database then specify the column to be of type `TIMESTAMP` and set it to ` DEFAULT CURRENT_TIMESTAMP` and when you add a record do not provide a timestamp value, then it will automatically be set to the current time.

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 13:43 UTC](https://discourse.nodered.org/t/date-formatting/36057/4 "2020-11-17T13:43:41Z")

</div>

Hello Paul. I have the date in a way, as you can see in the picture, and I want to change it to a value that is in hh.mm.ss.

 ![3](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c478fa62c3ba858471c4c83dc4c9080f82db4b79.png)

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 13:45 UTC](https://discourse.nodered.org/t/date-formatting/36057/5 "2020-11-17T13:45:46Z")

</div>

Hello colin. But i change here in the node template?

 ![4](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dcd12b7f1027d6816bf69925cd3674c1881e9572.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 November 2020 13:48 UTC](https://discourse.nodered.org/t/date-formatting/36057/6 "2020-11-17T13:48:06Z")

</div>

You did not make it clear that it is displaying the timestamp that is the problem. I thought you meant that you wanted to get the timestamp into the database.

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 13:52 UTC](https://discourse.nodered.org/t/date-formatting/36057/7 "2020-11-17T13:52:34Z")

</div>

Well, this I already have, I want is that instead of presenting the values, for example 1605613000818 present in the dd.hh.mm.ss. Is that possible?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 November 2020 13:58 UTC](https://discourse.nodered.org/t/date-formatting/36057/8 "2020-11-17T13:58:37Z")

</div>

Of course. This example from @E1cid shows an example of how to do it with jsonata in a change node. [Converting DateTime to dd/mm/yyyy hh:mm](https://discourse.nodered.org/t/converting-datetime-to-dd-mm-yyyy-hh-mm/36012/3)

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 14:02 UTC](https://discourse.nodered.org/t/date-formatting/36057/9 "2020-11-17T14:02:15Z")

</div>

Okay, I'll try it and then I'll say something.

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 14:04 UTC](https://discourse.nodered.org/t/date-formatting/36057/10 "2020-11-17T14:04:49Z")

</div>

I did this, but I'm in doubt, if this is correct.

 ![5](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/7/076bb37a96c8eb7fa510ce380edd851ab44095af.png)

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 November 2020 14:19 UTC](https://discourse.nodered.org/t/date-formatting/36057/11 "2020-11-17T14:19:02Z")

</div>

What relationship does that have to the example I linked to? There doesn't seem to be a JSON node in the example. Did you import the example and see how it works?

---

<div class="post-metadata">

### Author: ![teixeira\_5213](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@teixeira\_5213](https://discourse.nodered.org/u/teixeira_5213)
#### Post date: [17 November 2020 14:22 UTC](https://discourse.nodered.org/t/date-formatting/36057/12 "2020-11-17T14:22:19Z")

</div>

Yes, I did, but I realized I had to do this. I'm new at this of red node and java programming, so I don't quite understand some things, if you can explain it to me with examples, it would be a help, because really I'm a little lost.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [17 November 2020 14:30 UTC](https://discourse.nodered.org/t/date-formatting/36057/13 "2020-11-17T14:30:03Z")

</div>

If suggest you start by watching the Node-Red Essentials videos linked from the node red docs. An hour spent doing that will give you a lot of useful background information. Then look at the example again and see if you can understand how it works. Ask if there is something about it you don't understand. Then we can work out how to use it for your requirement, as it is a little more complex than the example, since you have multiple values to convert in an array.

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [17 November 2020 16:56 UTC](https://discourse.nodered.org/t/date-formatting/36057/14 "2020-11-17T16:56:12Z")

</div>

Here is another example of converting timestamps in an array to "YYYY-MM-DD HH:mm" format.  
[convert timestamps in array](https://discourse.nodered.org/t/how-to-get-array-using-split-node/35983/2)

---

<div class="post-metadata">

### Author: ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)
#### Post date: [17 November 2020 16:59 UTC](https://discourse.nodered.org/t/date-formatting/36057/15 "2020-11-17T16:59:14Z")

</div>

> [@teixeira\_5213](#):
>
> Hello Paul. I have the date in a way...

You could try using [angular](https://angular.io/api/common/DatePipe) to change the date format in your 'Table' `ui_template` node (not tested!).  
Something like this,

`<td>{{ msg.payload[$index].TIMESTAMP | date:'dd.HH.mm.ss' }}</td>`

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 December 2020 16:59 UTC](https://discourse.nodered.org/t/date-formatting/36057/16 "2020-12-17T16:59:19Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
