Date/time offset step

Want to adjust a date or a time by a year, a month, or maybe just a few minutes, in this article you'll learn how to use this custom step.

Updated over a week ago

After reading this article you'll learn how to:

  • Install the date/time offset step from the block store

  • Configure the date/time offset step

Starting off

The date/time offset step is created by Betty Blocks, but it's not readily available in the standard set of steps within the action builder. But that doesn't matter, you can find it and install it from the block store. To do this navigate to the block store and search for 'offset' it will pop up as the first hit.

Date time offset block in the block store

Click on view details to check out what the block is about. In our case, the step will explain that you can add or subtract for example days or hours. This tab also lets you install the block into one of your applications. Simply hit the Install block button and select your organization followed by your application.

Installing the date time offset block

After installing the 'date/time offset' step, it can be found in your action builder of the application that was selected. You'll find it in the miscellaneous section of the action steps.

Installed date time offset block

Configuring the step

For this example, I'll use the same use case used in the Using the generate UUID step. The only thing that we'll add for this use case is the following property:

  • Date 'Expiration date', required

Configuring the date time offset block: creating a new data model

Just like the article linked above; a page is created that allows a user to generate a coupon.

Configuring the date time offset block: adding a form component to the page

When we check out the action behind the form, more specifically the date/time offset step within the action it'll look like this:

Configuring the date time offset action step

In this example we want a coupon to expire after 6 months. In order to do this we selected the checkbox to use the current time/date. We then select month as the offset and give it the value 6; so 6 months. Select what type the result needs to be, this has to be the same as the property you want to save the data to, so select date time if that's the property type you use within your model.

The last and crucial step is to define which timezone we're dealing with, this is based on the location where your application is hosted. In this example, my application is hosted in the NL3 zone, so I selected UTC +1, but if you have an application in the zone USA2 then you need to select UTC -6 here. To see where your application's zone is located check my.bettyblocks.com and go to your application's overview to see the zone's location.

Configuring the date time offset step: defining the time zone

After creating a new coupon (the day of writing this article it is March 13th, 2023) it should say September 13th, 2023, so 6 months from now.

Date time offset: created coupon

And there we go, the expiration date is September 13th, as we expected. Of course you can be more specific than skipping 3 months, this step also works with time for example.

Did this answer your question?