-->
Page 1 of 1

Newby needs help to convert timestamp to human readable time

PostPosted: Thu Feb 10, 2022 4:21 pm
by TonisKipper
Hello!
I have searched a lot of internet but can't find answer how to convert timestamps to human readable format.
I get a info from api json timestamp + according data.
From this api https://dashboard.elering.ee/api/nps/pr ... %3A59.999Z

Please help how coud i convert this timestamp.
Thank you.

Re: Newby needs help to convert timestamp to human readable

PostPosted: Mon Feb 14, 2022 4:22 pm
by TonisKipper
This can be closed as i have found a easy solution.
eztime. library for mu nodemcu project.

If someone is searching this in future then
answer is : ( at least for me)

time_t t = timestamp; // + utcDifferece if want to get your local time
String datetime = String(year(t)) + "/" + String(month(t)) + "/" + String(day(t)) + " - " + String(hour(t)); // if needed exact then add //+String(minute(t))+":"+String(second(t)) etc.

Thank you

Re: Newby needs help to convert timestamp to human readable

PostPosted: Tue Feb 15, 2022 8:32 am
by rpiloverbd
Hello, would you please elaborate a bit more? Do you wish to use an ESP8266 for this conversion or you're using anything else?

Re: Newby needs help to convert timestamp to human readable

PostPosted: Tue Feb 15, 2022 11:29 am
by TonisKipper
rpiloverbd wrote:Hello, would you please elaborate a bit more? Do you wish to use an ESP8266 for this conversion or you're using anything else?


Hi, these post here appear with a lazy loading :D
So as u can see above i have found solution. But answering to your question then yes im using 8266 for my project. A bit about it also.
As there has been high energy prices i thought that i will make my own simple relay witch finds the best affordable time to switch on. And from that i started to learn programming again :) have been 20 years when i last did it :) So lot to learn.