How to convert Epoch time to human understandable format on the Sodaq One v3?

Hello,

At the moment I’m working on a project where I need to send out the time and GPS latitude and longitude from the Sodaq One. One of the challenges I’m facing is that the receiving system expects the time format in “dd-mm-yy hh:mm:ss”.

I’m using the SodaqOneTracker_v3 project from Github.

The conversion I need could probably be possible with the Time.h library but this library doesn’t play well with the MyTime.h library used in the project.

I have programming experience but my knowledge about Arduino and its language is limited.
The amount of data needed in the future makes manual conversion of the data undesired. I’m also not able to change the receiving system at the moment.

My question is:
Considering the above how can I change an Epoch like: 1529335135 to a date time format like: 18-06-18 17:18:55 on the Sodaq One in the SodaqOneTracker_v3 project?

Kind regards

The RTCZero library uses time.h in setEpoch() to convert the Epoch time to time / date format. https://github.com/arduino-libraries/RTCZero/blob/master/src/RTCZero.cpp

If you can’t use time.h an early version of the library did the conversion manually. See setY2kEpoch() (don’t forget the Y2K offset). https://github.com/arduino-libraries/RTCZero/blob/22debb0d9e25c624f4a27f9a60354df6190b3ee3/src/RTCZero.cpp

1 Like

Nice, that works! Thanks!