How to convert Time data from a function to integer.

Hi there,
I am using Time.h library to get the time from an NTP server and then convert it to integer for further manipulation. But the problem is that I don't know how to make Serial.print(day()); to an integer.
Whatever conversion I try I dont get the desired integer.

I give you the Time.h library so you can examine it if you want and help me through...

Please someone help!

Time.h (5.47 KB)

Time.cpp (7.71 KB)

The function day() returns an integer.

Please describe what you are seeing, and what you expect to see. As it stands you are making no sense.

What I need to do is to have day() saved as another integer.
I cannot make any changes to it because when I call the function, it only prints the values to serial monitor.
I want to copy them to another integer so I can store it.
Just that.

(I try it like: int sdday=day(); but it doesn't saves anything to sdday.)

nathanas:
But the problem is that I don't know how to make Serial.print(day()); to an integer.

int theDay = day ();

If that doesn't answer your question, can you explain why?

I am sorry it was something wrong with my code.
Thanks

1 Like