Rules: Display Message every first login per day; reset day 12:00am I am trying to create a rule that will display a message to the user when (s)he logs in for the first time that day.  Reset has to be per day at 12:00am.

Notice: not the first time in 24 hours but the first time that day.

So if user logs in 8/30/2016 11:59 and then 8/31/2016 12:01am then both times (s)he will see message.

I tried to achieve this using event 'User has logged in' and condition: data comparison and comparing last login date with current date and time and offset 1 day.  But it's not workings.  It might be possible to do this with the custom php?

Thanks God Bless.

------------------------------------------Update------------------------------------------

9/1/2016

I need help creating the following rule:

Trigger: User logs in

Condition: User hasn't logged in this today(since 12:00AM)

Action: Display message to user

Am I doing something wrong, or can this be achieved with custom Php?
My attempt is described in first update.  Can't seem to make this work.  The message should only appear every day.

Day = 12:00:00AM - 11:59:59PM
There's a few things to mention here. 


Using the [account:last-login] token won't work here; Drupal's login process updates the user account login timestamp before User logs in event.
Using the [account:last-access] token will work however because the User logs in event triggers before Drupal updates the access timestamp.
PHP's strtotime() has a special keyword for the significant time you're looking for; strtotime('midnight') produces the timestamp of when the current day started.


Putting that together, you can create your own custom rules condition via hook_rules_condition_info() and using it compare against the [account:last-access] token in the User logs in event to produce the effect you're looking for:

/**
 * implementation of hook_rules_condition_info()
 */
function MYMODULE_rules_condition_info() {
  return array(
    'MYMODULE_condition_before_midnight' =&gt; array(
      'label' =&gt; t('Before Midnight'),
      'arguments' =&gt; array(
        'last_login' =&gt; array('type' =&gt; 'date', 'label' =&gt; t('The date to compare.')),
      ),
      'module' =&gt; 'MYMODULE',
      'group' =&gt; t('MYMODULE'),
    ),
  );
}

/**
 * Condition MYMODULE_condition_before_midnight
 */
function MYMODULE_condition_before_midnight($last_login) {
  return ($last_login &lt; strtotime('midnight'));
}