Fun With Date & Time Fields

ActiveDEMAND has the ability to display dates and times with some kind of added (or subtracted) offset.

For example, if I have an appointment time on 2020-10-15 at 12:30, and I want the client to arrive 15 minutes early, I can ask them to arrive at 12:15.

Where can I use this?

You can use this on any date and time field. Using the above example, I could show the following in my appointment confirmation email:

Your appointment is at: %APPOINTMENT.START_AT.%

Please arrive at: %APPOINTMENT.START_AT.SUB(15.minutes)%

 

Which would appear to your contact as:

Your appointment is at: 2020-10-15 12:30

Please arrive at: 2020-10-15 12:15

 

The key in the above example is the .SUB part:

%APPOINTMENT.START_AT.SUB(15.minutes)%

 

For any date/time field you can append either .SUB(<time offset>) or ADD(<time offset>).

 

What are the available functions available to manipulate or extract certain parts of date and time fields?

There are four main operations you can use on a date/time field:

.ADD(<time offset>)

.SUB(<time offset>)

.TO_TIME

.TO_DATE

 

Let's assume a date and time field has the value we used earlier: 2020-10-15 12:30. The above operations will yield the following results:

%APPOINTMENT.START_AT.ADD(2.days)% => 2020-10-17 12:30

%APPOINTMENT.START_AT.SUB(1.hours)% => 2020-10-15 11:30

%APPOINTMENT.START_AT.TO_TIME% => 12:30

%APPOINTMENT.START_AT.TO_DATE% => 2020-10-15

 

Notice that .TO_TIME extracts only the time from a date and time field, while .TO_DATE extracts only the date from the date and time field.

 

What units are available for the .ADD and .SUB operations?

You can use the following units in your calculations/offsets:

.minutes

.hours

.days

.months

.years

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.