Post topics, source code that relate to the Arduino Platform

User avatar
By JeremiahLandi
#32901 Hello Community!

I have embarked on the following project "SETTING A RANGE (SLIDER) VALUE (ARDUINO IDE)" (http://www.esp8266.com/viewtopic.php?p=20544).

I have the NodeMCU Amica with ASP8266 (http://www.electrodragon.com/product/nodemcu-lua-amica-r2-esp8266-wifi-board/). I was wondering if someone could point me to example code to display the time from the clock onto the web page?

I have scoured the internet and wasn't able to find any information. I am trying to display the time on the website and have it activly sync without refreshing the whole page. Any help or links to help would be greatly appreciated.

Thank you.
User avatar
By JeremiahLandi
#32952 So digging a little deeper about this I have found the Arduino Time library (#include <Time.h>):

Functional Overview

hour(); // The hour now (0-23)
minute(); // The minute now (0-59)
second(); // The second now (0-59)
day(); // The day now (1-31)
weekday(); // Day of the week, Sunday is day 1
month(); // The month now (1-12)
year(); // The full four digit year: (2009,
// 2010 etc)

there are also functions to return the hour in 12 hour format

hourFormat12(); // The hour now in 12 hour format
isAM(); // Returns true if time now is AM
isPM(); // Returns true if time now is PM
now(); // Returns the current time as seconds
// since Jan 1 1970

http://playground.arduino.cc/code/time

This does a pretty thorough job of talking about time and was what I was looking for.

As a side note I did find an article about synicing the clock with an online source on instructables (http://www.instructables.com/id/Arduino-Internet-Time-Client/?ALLSTEPS).

My next project is to have the Arduino IDE is to display this time on the website :)