void Clock::printDate() {

	// May 22, 2015
	lcd.print(monthShortStr(month(currentTime)));
	lcd.print(' ');
	lcd.print(day(currentTime));
	lcd.print(", ");
	lcd.print(year(currentTime));
}
//////////////////////////////////////////////////////////////////////////////////////////////////
// check if system date is valid and send the date header.
//////////////////////////////////////////////////////////////////////////////////////////////////
void ESP8266WebServerEx::sendDateHeader(char* buf) {
  time_t t = now();
  // if time is accurate, then try to send a Date header Wed, 15 Nov 1995 06:25:24 GMT
  if ( year(t)>2015 ) {
    char dow[5];  
    strncpy(dow,dayShortStr(weekday(t)),4);
    dow[3] = 0;
    sprintf(buf,"%s, %02u %s %04u %02u:%02u:%02u GMT",dow,day(t),monthShortStr(month(t)),year(t),hour(t),minute(t),second(t));
    sendHeader("Date",buf);
  } 
}
示例#3
0
文件: DateFormats.cpp 项目: kiuz/Time
/**
 * Display Date and Time with 'hh:mm:ss <ShortNameDayWeek> dd <ShortNameMonth> YYYY' format
 */
void shortStrFormat_Display(){
	
	timeComplete_Display();

	Serial.print(" ");
	Serial.print(dayShortStr(weekday()));
  Serial.print(" ");
  Serial.print(day());
  Serial.print(" ");
  Serial.print(monthShortStr(month()));
  Serial.print(" ");
  Serial.print(year());
}
示例#4
0
//Function to print time with time zone
void printTime(time_t t, char *tz)
{
    sPrintI00(hour(t));
    sPrintDigits(minute(t));
    sPrintDigits(second(t));
    Serial.print(' ');
    Serial.print(dayShortStr(weekday(t)));
    Serial.print(' ');
    sPrintI00(day(t));
    Serial.print(' ');
    Serial.print(monthShortStr(month(t)));
    Serial.print(' ');
    Serial.print(year(t));
    Serial.print(' ');
    Serial.print(tz);
    Serial.println();
}