Go Down

Topic: How to convert Time data from a function to integer. (Read 439 times) previous topic - next topic

nathanas

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!

majenko

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.

nathanas

#2
Feb 17, 2013, 01:04 am Last Edit: Feb 17, 2013, 01:13 am by nathanas Reason: 1
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.)

Nick Gammon


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


Code: [Select]

int theDay = day ();


If that doesn't answer your question, can you explain why?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

nathanas

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

Go Up