Pages: [1]   Go Down
Author Topic: How to convert Time data from a function to integer.  (Read 337 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Full Member
***
Karma: 1
Posts: 179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 - downloaded 7 times.)
* Time.cpp (7.71 KB - downloaded 7 times.)
Logged

UK
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

0
Offline Offline
Full Member
***
Karma: 1
Posts: 179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.)
« Last Edit: February 16, 2013, 07:13:19 pm by nathanas » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Code:
int theDay = day ();

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

0
Offline Offline
Full Member
***
Karma: 1
Posts: 179
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: