Skip to main content

Manage the date and time in your feeds

Use rule boxes in Dataflow or Data View to manage the date and time in your feed in Productsup.

Introduction

If your product data contains date and time values, you can use rule boxes in Dataflow or Data View to optimize it.

Productsup offers rule boxes that can perform the following tasks with your date and time values:

  • Add the current date and time to an attribute with the Set Timestamp rule box

  • Convert a date to a timestamp with the Convert to Timestamp rule box

  • Change the date format with the Convert Datetime Format rule box

  • Assign, append, or prepend a value based on a date with the Set Column by Time rule box

  • Assign a value based on comparing the feed date and set date with Set Value by Datetime rule box

  • Add a temporary text or discount based on a date with the Limited Time Only rule box

Another option to work with time-bound values is to schedule rule boxes. See Advanced rule box options.

Note

You can add a rule box in both Dataflow and Data View. This document describes how to add and set up each rule box in Data View.

Add the current date and time to an attribute

Use the Set Timestamp rule box to overwrite the values in an attribute with the current date and time in a desired time zone and format. A timestamp is a sequence of characters or encoded information identifying when a certain event occurred, usually giving date and time of day, sometimes accurate to a small fraction of a second.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Set Timestamp rule box.

    Set Timestamp rule box
  6. In Format, enter the date format that the rule box should use to add the current date and time to your attribute. See PHP: date - Manual for the supported formats.

    Tip

    To add a Unix timestamp instead of standard date formats, enter U.

  7. In Timezone, select the needed time zone.

  8. Select Save to apply the rule box.

Convert a date to a timestamp

Use the Convert to Timestamp rule box to convert a date or a date-related text into a Unix timestamp. For example, you can convert the following strings into timestamps:

  • now

  • 2 June 2023

  • +1 week 2 days 4 hours 2 seconds

  • next Thursday

Note

If your values contain only a date without the exact time, for example, 01.02.2023 instead of 01.02.2023 10:48:01, the rule box Convert to Timestamp works as follows:

  • Assumes the time is 00:00 in your current time zone.

  • Converts this time into the GMT time zone.

  • Converts your date into a timestamp using the assumed time in the GMT time zone.

For example, the full date and time 01.02.2023 10:48:01 in the GMT+1 time zone convert to the timestamp 1643708881, but the date without the time converts to 1643670000.

See PHP: strtotime - Manual for the supported string formats you can convert into a timestamp.

To add the Convert to Timestamp rule box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Convert to Timestamp rule box.

    Convert to Timestamp
  6. Select Save to apply the rule box.

Change the date format

Use the Convert Datetime Format rule box to change the format of your date and time values.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Convert Datetime Format rule box.

    Convert Datetime Format
  6. In Source Format, enter your current date format. See PHP: date - Manual for the supported formats.

    Tip

    If you want to convert your date format into a Unix timestamp, the attribute where you apply the rule box needs to contain the full date and time, including hours, minutes, and seconds. If it doesn't, the platform uses the provided date elements and adds the hours, minutes, and seconds of the moment when you saved the rule box or your last site run.

    To assume the missing time elements, the rule box uses the GMT time zone and the H:i:s time format.

  7. In Target Format, enter the desired date and time format. For example, enter U to convert your regular date format into a Unix timestamp. See PHP: date - Manual for other supported formats.

  8. Select Save to apply the rule box.

Examples of applying the rule box Convert Datetime Format to convert a date into the d-m-Y format:

Current value

Source Format input

Target Format input

Result value

20230525 18:05:45

Ymd H:i:s

d-m-Y

25-05-2023

20230525 18:05:45

Ymd H:i:s

U

1685030745

20230525

Ymd

U

1685008255

Note

The moment when you saved the rule box was at 09:50:55 GMT+0000.

The last example shows how the rule box works if your current value doesn't include hours, minutes, and seconds.

Assign, append, or prepend a value based on a date

Use the Set Column by Time rule box in a desired attribute to assign, append, or prepend a value from another attribute based on a date-and-time condition. A date and time condition works as follows:

  1. In the rule box setup, you choose a date attribute and select whether the date in that attribute should be in the past, future, or now to meet the desired date and time condition.

  2. If the date meets the desired date andtime condition, the platform assigns, appends, or prepends a value from another selected attribute to the attribute where you apply the rule box.

The Set Column by Time rule box may be helpful when launching a sale. For example, you are selling a popular sneaker model, but a newer sneaker model is going to drop soon, and you have that release date in your feed. You also have a short sale promo text in another attribute and want to append that short sale promo text to the title of the older sneakers to attract more attention and announce a sale as soon as the newer sneakers model gets released. You can use the Set Column by Time rule box to modify the older sneakers' title:

Current product title

New sneaker release date

Desired date condition

Sale promo text to append

New product title

Old sneakers

5 June 2023

in the past

25% OFF

Old sneakers 25% OFF

In this example, the platform checks whether the new sneaker release date passed or not. As soon as that date passed, the platform appends the sale promo text to the title of your product.

To add and set up the Set Column by Time rule box:

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Set Column by Time rule box.

    Set column by time
  6. In Source Column, choose your date attribute.

  7. In Time Format, enter the format used in your date attribute. See PHP: date - Manual for the supported formats.

  8. In the drop-down menu, select your desired date-and-time condition:

    1. in the future

    2. in the past

    3. now

  9. In Column, select the attribute that stores the values you want to assign, append, or prepend.

  10. In Mode, choose how you want to modify your current values if the date attribute meets the desired date and time condition:

    1. assign overwrites the current value with the value of the attribute chosen in Column.

    2. append adds the value of the attribute chosen in Column at the end of the current value.

    3. prepend adds the value of the attribute chosen in Column at the beginning of the current value.

  11. Select Save to apply the rule box.

Assign a value based on comparing the feed date and current date

Use the Set Value by Datetime rule box to compare a date value from your feed with the current date and assign a value based on the difference between both dates. The date from your feed should be in a valid php datetime format.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Set Value by Datetime rule box.

    Set_Value_by_Datetime.png
  6. Enter the date format used in your feed in Date Format.

  7. In Operator, choose an operator based on the way you want to compare the feed date to the current date:

    • < is less than the number of the set days

    • <= is less or equals to the number of the set days

    • >= is greater or equals to the number of the set days

    • > is greater than the number of the set days

  8. In Set Days, enter the number of days the date should differ from the feed date.

    Note

    Set Days implies the current datestamp. Adding + or - to the number of the days modifies the current datestamp. For example, if you enter +, the current date changes into tomorrow’s date. If you enter -1, the current date changes into yesterday’s date. And if you enter +0, the current date doesn't change. The setting may be such as: If the current day +/- Set Days <= datestamp in the attribute, set value {some value}.

    Set day in Set value by the datetime
  9. In Set value, enter the value you want to assign if the above criteria match.

  10. Select Save to apply the rule box.

Example:

You want to assign a value Discount if the date in your feed is greater than -20 days. The date in your feed: 01-05-2024.

  • Date Format: d-m-Y

  • Operator: >=

  • Set Days: -20

  • Value: Discount

The setting may be: If current_date -20 days >= datetime_from_feed, set value Discount.

Add a temporary text or discount based on a date

Use the Limited Time Only rule box to temporarily change a value in the attribute. This rule box can change a value by applying a discount, assigning a new value, and appending or prepending a string to a value. You can set the timeframe when the platform should change the values manually or by using dates stored in other attributes.

  1. Go to Data View from the site's main menu.

  2. Choose the needed export channel or the intermediate stage in the drop-down menu on the left.

  3. Select Edit in the attribute's column where you want to apply the rule box.

  4. Select the Add Box drop-down menu.

  5. Search for and select the Limited Time Only rule box.

    Limited time only
  6. Use one of the following options to define the start date for applying the changes to your attribute:

    Note

    For both options, your dates need to be in the format Y-m-d, for example, 2024-01-31.

    1. Select a relevant attribute that stores the needed date in Start Date via Column.

      If you add your rule box in the intermediate stage, only import-stage attributes are available in this drop-down menu. If you add it in the export stage, only intermediate-stage attributes are available.

    2. Enter the date manually in set Start Date.

  7. Use one of the following options to define the end date for applying the changes to your attribute:

    Note

    For both options, your dates need to be in the format Y-m-d, for example, 2024-01-31.

    1. Select a relevant attribute that stores the needed date in End Date via Column.

      If you add your rule box in the intermediate stage, only import-stage attributes are available in this drop-down menu. If you add it in the export stage, only intermediate-stage attributes are available.

    2. Enter the date manually in set End Date.

  8. Choose how you want to change the values in your attribute:

    1. If you want to add certain text to your attribute, enter the desired text in Text and choose how you want the rule box to modify your current value with this text in Mode:

      1. assign completely overwrites the value with the desired text.

      2. append adds the desired text at the end of the value.

      3. prepend adds the desired text at the beginning of the value.

    2. If you want to add a discount to your attribute, enter the needed amount in Discount. Enter a number without the percent symbol (%).

  9. Select Save to apply the rule box.