1

I'm trying to figure out how to find the next day date (xx/xx/xx 00:00:00) from the given date&time value in rules without the use of PHP filter module. Played with offset already - couldn't get the needed result.

The idea is to set up scheduled task in Rules that will take the date & time value from a node field#1 and change the field#2 on that node at midnight of the next day.

EDITED: To simplify: if my date field = 07/30/15 05:00:00 how do I schedule task at 07/31/15 00:00:00 without the use of PHP filter.

Any ideas are greatly appreciated.

1 Answer 1

2

Let's see my example.

First: I created content type with two date fields: date1 and date2

Second: I created rule rule

  1. Create Action 'Add variable' to store first date field value in your variable

  2. Create Action 'Set data value' and choose your second date field as Data and your variable name as Value

  3. Create Action 'Set data value' and choose your second date field as Data and don't "Switch to data selector", simply set "+1 day midnight" as Value

What's the point: when you r creating 'Set data value' action and choosing Date type you can see next description under Value field in form:

The date in GMT. You may enter a fixed time (like 2015-08-16 14:05:10) or any other values in GMT known by the PHP strtotime() function (like "+1 day"). Relative dates like "+1 day" or "now" relate to the evaluation time.

If you google strtotime() php function you can simply understand what goes on.

"+1 day midinight":

  • "+" means add

  • "day" means what to add

  • "midnight" means "The time is set to 00:00:00"

2
  • A REALLY BIG THANK YOU! The most valuable information in this answer is Step 1-3. Setting variables and then changing the value of those variables. This approach just reduced my database by one unnecessary field. Thanks again!
    – oksana-c
    Commented Aug 15, 2015 at 14:39
  • You r welcome, glad to help! Commented Aug 15, 2015 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.