using putty on the terminal.


#include "RTClib.h"
DateTime now;
RTC_PCF8523 rtc;

void loop() {

  if (digitalRead(15) & millis() < 5000) { //enter setup mode if d15 pulled high within 5 sec of power on.
  Serial.print("\033[?25l"); // hide cursor
  Serial.print("\033[2J"); // clear screen & home

  while (digitalRead(15)) { // stay in setup mode while d15 kept high.
    now = rtc.now();
    Serial.print("\033[0;0H"); // cursor to line 0 col 0
    uint16_t year = now.year();
    Serial.print(year, DEC);
    Serial.print('/');
    uint8_t month = now.month();
    if (month < 10) {
      Serial.print("0");
    }
    Serial.print(month, DEC);
    Serial.print('/');
    uint8_t day = now.day();
    if (day < 10) {
      Serial.print("0");
    }
    Serial.print(day, DEC);
    Serial.print(' ');
    uint8_t hour = now.hour();
    if (hour < 10) {
      Serial.print("0");
    }
    Serial.print(hour, DEC);
    Serial.print(':');
    uint8_t minute = now.minute();
    if (minute < 10) {
      Serial.print("0");
    }
    Serial.print(minute, DEC);
    Serial.print(':');
    uint8_t second = now.second();
    if (second < 10) {
      Serial.print("0");
    }
    Serial.print(second, DEC);
    Serial.print("\n\rUse keys y, m, d, h, M, s to change\n");

    if (Serial.available()) {
        switch (Serial.read()) {
            case 'Y':
            case 'y': {
                ++year;
                if (year > 2099) {year = 2000;} 
                rtc.adjust(DateTime(year, now.month(), now.day(), now.hour(), now.minute(), now.second()));
                break;
            }
            case 'm': {
                if (month > 11) {month = 0;}
                ++month;
                rtc.adjust(DateTime(now.year(), month, now.day(), now.hour(), now.minute(), now.second()));
                break;
            }
            case 'D':
            case 'd': {
                if (day > 30) {day = 0;}
                ++day;
                rtc.adjust(DateTime(now.year(), now.month(), day, now.hour(), now.minute(), now.second()));
                break;
            }
            case 'H':
            case 'h': {
                ++hour;
                if (hour > 23) {hour = 0;}
                rtc.adjust(DateTime(now.year(), now.month(), now.day(), hour, now.minute(), now.second()));
                break;
            }
            case 'M': {
                ++minute;
                if (minute > 59) {minute = 0;}
                rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), minute, now.second()));
                break;
            }
            case 'S':
            case 's': {
                ++second;
                if (second > 59) {second = 0;}
                rtc.adjust(DateTime(now.year(), now.month(), now.day(), now.hour(), now.minute(), second));
                break;
            }
        }
    }
   }
  }
}