Date Interval

Returns the boundaries (start Date or Datetime and end Date or Datetime of the period) of the given date, corresponding to the specified time unit and offset. Allows getting the first date of the month, last date of the Quarter, etc. Useful to build Conditions, set value for a field (e.g. Valid Until in Quotes), and in Email Notifications. 

Keep in mind when dealing with Time that in Sugar interface dates are displayed in the current users’ TimeZone. In Logic Builder dates are as values from the database – in UTC format.

inputs: 

first input – select directly in the operator the time unit, whose boundaries to calculate with respect to the specified date value and offset. 

  • Required: yes

In the table below please find examples of output values for each Unit when the Input Date is Wednesday, 2021-11-24 16:29:00

Unit start end
Minute 2021-11-24 14:29:00 2021-11-24 14:29:59
Hour 2021-11-24 14:00:00 2021-11-24 14:59:59
Day 2021-11-24 00:00:00 2021-11-24 23:59:59
Week 2021-11-22 00:00:00 2021-11-28 23:59:59
Month 2021-11-01 00:00:00 2021-11-30 23:59:59
Quarter 2021-10-01 00:00:00 2021-12-31 23:59:59
Year 2021-01-01 00:00:00 2021-12-31 23:59:59

Use Minute and Hour units only for Datetime input.

date – input the anchor date value.  It can be a date or datetime only.

  • Required: yes

When the input is a date, the output is a date as well, without time, e.g. end of the year 2021 is 2021-12-31

When the input is a datetime, the output is a datetime as well.

offset – input the number of selected time units to offset dates in the result. 

  • Required: no

If the offset is 0 or not set then the operator produces the first and the end dates of the specified interval that provided date belongs to:

E.g. for a date value “23d February 2021 05:47:00” with the set time unit to “Month” and offset to “0”, it returns values “1st February 2021 00:00:00” and “28 February 2021 23:59:59”

If the offset is a positive (or negative) number, the operator produces the first and the end dates of the interval shifted from the current by the specified number

E.g. for a date value “23d February 2021 05:47:00” with the set time unit to “Month” and offset to “1”, it returns values “1st March 2021 00:00:00” and “31 March 2021 23:59:59”

outputs: 

start – contains the start date (or date and time) of the interval. 

end –  contains the end date (or date and time) of the interval. 

Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply

Your email address will not be published. Required fields are marked *