Documentation for Time() functions

Hello all! I am working on an alarm clock and am SO thrilled to see the Photon has a RTC!!

The thing is I can not seem to locate the documentation for the time() function - any thoughts?

So far I have these “figured out”:
Time.timeStr());
Time.month(); (outputs number, not text)
Time.day();
Time.hour();

Needless to say I’m new to all of this. I know ont thing I’ll also have to ask for are any tips in storing / retrieving alarms from EEPROM.

Also noticed that I have to use Time.zone(-4) to get correct time for EST even though (-5 GMT) is EST

Thanks!

  • JR -
1 Like

Try "DOCUMENTATION" at the top of this page and enter e.g. "timeStr()" in the search box, this will lead you to
https://docs.particle.io/reference/firmware/photon/#timestr-

or what do you mean with time() function?

This is about the Time class/object
https://docs.particle.io/reference/firmware/photon/#time+

About Time.zone() you have to be aware of possible daylight safing time, which might explain your 1h difference.
UTC (the Coordinated Universal Time) does not take care of that, so your local time might have different offsets with/without DST.
Hence the docs state

For an alarm clock, you might also like to look into the TimeAlarms library available on Web IDE (Particle Build)

2 Likes

To expand on what @ScruffR already said – in general, you will find what you want in the Reference section of the docs. And if you aren’t sure which category something might be under, searching will usually get you where you need to go.

Also, we’re in Daylight Savings Time right now, which is why the timezone offset is -4 instead of -5. Because, we’re in EDT, not EST right now. For a few more days, at least.

(Grrr, daylight savings – I hateses it!)

Thanks gentlemen! This is precisely what I was looking for but couldn’t find!!

One last Q - I see TimeAlarms() are a library in the build.io and not under documentation - are there any explanation on the libary’s use beside the example?

That is a port of the Arduino library here:

http://www.pjrc.com/teensy/td_libs_TimeAlarms.html

Feel free to ask questions after you have read a bit.

3 Likes

awesome - thx!!