Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bidirectional to/from unix_time timestamp in PLCs #2

Open
kootzie opened this issue Mar 22, 2021 · 1 comment
Open

Bidirectional to/from unix_time timestamp in PLCs #2

kootzie opened this issue Mar 22, 2021 · 1 comment
Labels
question Further information is requested

Comments

@kootzie
Copy link

kootzie commented Mar 22, 2021

I am looking for functions to/from unix_time in PLCs
so I can do time_math such as what is the time-span
between two date_times and what is the date_time of
287 hours from now

Is it as simple as generating inversions of these functions to get
from time_stamp back to YYYY-MM-DD H:MM:SS ?

oh, and examples folder is 404

@alve89 alve89 added the question Further information is requested label Mar 24, 2021
@alve89
Copy link
Owner

alve89 commented Mar 24, 2021

Actually I'm not sure if I get your question right, sorry.
You want to get the time-span between to dates - that's actually quite simple by substract timestamp A from timestamp B and divide the result (= seconds between two datetimes) by 86400 (= 60sec/min x 60min/h x 24h/d).
Also you want the date_time of 287 hours from now which is just the current timestamp plus 287*3600 (=60sec/min x 60min/h).
I hope this is the answer to your questions, otherwise let me know.

Is it as simple as generating inversions of these functions to get
from time_stamp back to YYYY-MM-DD H:MM:SS ?

That's actually covered in the examples (when I get your question right): /examples/convertTimestampToDate/convertTimestampToDate.ino

And

oh, and examples folder is 404

is not clear as the folder is filled with two examples (convertTimestampToDate, getTimestamps). How do you get a 404?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants