How do I create an if statement based on RTC time using ESP8266-approved library

I am looking at starting events at specific times as well as on an hourly basis without using the alarmfunction of a DS3231 RTC.

I found this thread covering this aspect but it uses the RTClib.h library while when using an ESP8266 an appropriate (approved) library has to be used such as RtcDS3231.h from Makuna.

The code in the post linked here above is exactly what I need except it needs to be adapted for the RtcDS3231.h library.

I am not sure about what needs to be adapted in this code so that it works with the RtcDS3231.h library instead of the RTClib.h library? I copied the code that needs to be adapted here below (it includes a useful state function):

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 rtc;

void setup () {

void loop () {
    DateTime now =;
   if(now.hour() == 6 && now.minutes() == 00){
     //do something

PS: Makuna

name=Rtc by Makuna
author=Michael C. Miller (
maintainer=Michael C. Miller (
sentence=A library that makes interfacing DS1307 and DS3231 Real Time Clock modules easy.
paragraph=Includes deep support of module features, including temperature, alarms and memory storage if present. Tested on esp8266.
category=Device Control

RtcDS3231.h (13.5 KB)

RtcDateTime.h (3.4 KB)

RtcDateTime.cpp (2.7 KB)

keywords.txt (2.45 KB)

Are you able to print the time from the RTC ? If so, how ?

No, sorry, I would not know how to do that with the ESP8266 yet, can you please give a hint?
Thank you

I am not able to give specific advice about using the ESP8266 as I know nothing about them. My point was that if you could print the time then it would be easy to compare the time with something.

It sounds like your query is actually about how to use the RTC with the ESP8266. Are there any examples with the library ?

No examples about the use with the ESP8366 in that library but your suggestion got me thinking about first trying this code with an Arduino. I think I would/should be able to port it to the ESP8266 afterwards.

I will do some testing and let you know back in this topic. Will be a in few days.