Last time update


#1

I know this Topic has been addressed before, but the solution does not work for me (It only shows time I UNIX format I guess). So please, how can I make a widget which shows the time of last update? If possible, in Europe/Berlin time.

Please be detailed in your description, as I am a new user

Thanks in advance
Poul


#2

Greetings, you can convert unix time to human readable using the JS Date class, you can find an example here.

All the best


#3

Hi, and thanks for your answer… I have implemented the html and js in a blank HTLM widget, and it works fine with this function call Unix_timestamp(1412743274);
However, I have not yet figured out, ow to replace the unix variable in the function call with a result or timestamp from my variable. Is it some like variableid.{{timestamp}} e.g Unix_timestamp(5c4aded05916365f87cd07fe.{{timestamp()}});

Pls advise

br Poul


#4

This is not a valid way to get data, you should open a socket to listen for variable’s changes and to parse the incoming timestamp using your actual function accordingly, for more information, please refer to this example.

All the best


#5

Thanks again for your support.
Your suggestion looks complicated.
Is it the only solution?

In the ‘chart’ widget, hovering the mouse over the values, the time and date for the readings are displayed. So I guess the time data is available for all widgets. I also send the UNIX time stamp from the Sigfox callback in a context, but again, how to format it to a readable string?
ps. I cannot send the time data as string from my device, as time is not present.

Thanks in advance


#6

Greetings,

All the Ubidots widgets implement a Pub socket in the way that I have shared with you, this is the most efficient and lightweight way to implement a Real Time solution. As you are using a HTML Canvas, you will have to implement the socket by yourself just as the example shows, it is not difficult as always as you follow the tutorial.

Please remember that the HTML Canvas is intended for users with JS and HTML knowledge as self-service way to create your own custom widgets, if it is the first time for you using these concepts, I would advise you to begin with the basics before of trying to make the widget. Also, if you are looking for a business solution, you can ask for a development quota at sale@ubidots.com and an IoT specialist will be attentive to your inquiry.

All the best