Display Timestamp via Serial

Hi all,

I am kinda new to the Arduino. Here I want to display the timestamp in "month, day, minute, second" format after each sampling from the connected sensor via Serial. However, the only thing I can find is the millis() function. Is there any way to translate the millis to my desired format? Many thanks.

Sincerely, Michael

EEfigo:
Hi all,

I am kinda new to the Arduino. Here I want to display the timestamp in “month, day, minute, second” format after each sampling from the connected sensor via Serial. However, the only thing I can find is the millis() function. Is there any way to translate the millis to my desired format? Many thanks.

Sincerely,
Michael

Hey Michael - sorta new here as well - but since the Arduino has no real time clock, you’ll have to derive your data from millis() and knowing the time when you start. Also keep in mind that you’ll overflow your largest native storage element in ~51 days.

SystemsGuy: Hey Michael - sorta new here as well - but since the Arduino has no real time clock, you'll have to derive your data from millis() and knowing the time when you start. Also keep in mind that you'll overflow your largest native storage element in ~51 days.

Or put a RTC on your Arduino https://www.adafruit.com/products/264. Or if you have a GPS unit on your Arduino, the GPS stream provides the real time as part of the data stream.

Another way to do it is not print out the timestamp in the Arduino, but instead have the reader of the serial output on the PC add the timestamp when it reads a line.

EEfigo: I want to display the timestamp in "month, day, minute, second" format after each sampling from the connected sensor via Serial.

What is reading the serial stream from the Arduino? If it's any kind of PC, that would be the obvious place to do your timestamping.