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?
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?
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.
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.
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.
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?
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
Okay, I'll try it and then I'll say something.
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?
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.
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.
Here is another example of converting timestamps in an array to "YYYY-MM-DD HH:mm" format.
convert timestamps in array
You could try using angular 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>
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.