Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18347

Re: How to get current time

$
0
0

Peter, here is the code that produces 1970 dates.

 

#include<time.h>

 

void setup()

char cTime[22];

 

sprintf(cTime, "%04d.%02d.%02d.%02d:%02d:%02d", year(), month(), day(), hour(), minute(), second());

 

Serial.println(__DATE__);

 

Serial.println(cTime);

}

 

Here is the output:

 

Nov 11 2014

1970.01.01.00:00:02

 

 

 

If you can tell me how to format __DATE__ to YYYYMMDD:HHmmSS then I will be happy and can move on.

 

Thank you for your help.


Viewing all articles
Browse latest Browse all 18347

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>