[Solved] openHAB REST API: conversion of "time" in mapdb-persistence

After opening REST API to find out, what is the status and when this was it changed in the REST API in the tab

GET /persistence/items/{itemname}

I put in the name of the item and pressed the button Try it out!
and I got the following result in the section Response Body:

{ "name": "eg_wf_k_haustuer", "datapoints": "1", "data": [ {"time": 1598471252653, "state": "CLOSED" }] }

How can I transfer the value of “time”:1598471252653 to a “readable” time expression? I searched in the community for any hint, but I did not find anything. The remaining data are clear for me so far.
Sorry for todays maybe stupid request.

I am using the following setup:
Hardware: RPI 4
openHAB version: 2.5.8 (Release Build)

Thanks in advance.


tl;rd: That number is epoch, sometimes called Unix Time. It’s the number of milliseconds that have passed since 1970-01-01T00:00:00.000 GMT. There are tons of converters out there. This one was at the top of the DuckDuckGo search. https://www.epochconverter.com/.

Epoch is the way that computers keep time. Time 0 is midnight January 1, 1970 GMT. This is the raw data that every date time object in every programming language I know about uses to represent time. And then when you ask for a more human friendly version of the time, it takes that raw number of milliseconds and does all the math to convert it to a year:month:day hour:minute:seconds.milliseconds for your current time zone, taking into account daylight savings and leap seconds and any other local or international variations. But underneath it all, it’s just a number that grows by one every millisecond.

And that millisecond count is what MapDB (most databases really) uses to store the timestamp. The database and usually the computer doesn’t know and doesn’t care that it’s a specific time at a specific location on the world. It only cares that this entry occurred before that entry and to achieve that all it needs is a number.

Thanks @rlkoshak for the very fast reply and my lessons learned. :blush: