{"id":804,"date":"2022-01-14T13:30:02","date_gmt":"2022-01-14T13:30:02","guid":{"rendered":"https:\/\/logicbuilder.integroscrm.com\/help\/?page_id=804"},"modified":"2022-06-10T10:02:52","modified_gmt":"2022-06-10T10:02:52","slug":"date-interval","status":"publish","type":"page","link":"https:\/\/logicbuilder.integroscrm.com\/help\/date-interval\/","title":{"rendered":"Date Interval"},"content":{"rendered":"\n<p><a name=\"abstract\"><\/a>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.&nbsp;<\/p>\n\n\n<div style=\"background-color: #ddeaff; border-left: 6px solid #0072b3; padding: 12px;\">\n<p>Keep in mind when dealing with Time that in Sugar interface dates are displayed in the current users&#8217; TimeZone. In Logic Builder dates are as values from the database &#8211; in UTC format.<\/p>\n<\/div>\n\n\n<p><strong>inputs:&nbsp;<\/strong><\/p>\n\n\n\n<p><em>first input<\/em>&nbsp;&#8211; select&nbsp;directly in the operator the time unit, whose boundaries to calculate with respect to the specified date value and offset.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: yes<\/li><\/ul>\n\n\n<div style=\"background-color: #ddeaff; border-left: 6px solid #0072b3; padding: 12px;\">\n<p>In the table below please find examples of output values&nbsp;for each Unit when the Input Date is Wednesday, 2021-11-24 16:29:00<\/p>\n<table>\n<tbody>\n<tr>\n<td><em>Unit<\/em><\/td>\n<td><em>start<\/em><\/td>\n<td><em>end<\/em><\/td>\n<\/tr>\n<tr>\n<td>Minute<\/td>\n<td>2021-11-24 14:29:00<\/td>\n<td>2021-11-24 14:29:59<\/td>\n<\/tr>\n<tr>\n<td>Hour<\/td>\n<td>2021-11-24 14:00:00<\/td>\n<td>2021-11-24 14:59:59<\/td>\n<\/tr>\n<tr>\n<td>Day<\/td>\n<td>2021-11-24 00:00:00<\/td>\n<td>2021-11-24 23:59:59<\/td>\n<\/tr>\n<tr>\n<td>Week<\/td>\n<td>2021-11-22 00:00:00<\/td>\n<td>2021-11-28 23:59:59<\/td>\n<\/tr>\n<tr>\n<td>Month<\/td>\n<td>2021-11-01 00:00:00<\/td>\n<td>2021-11-30 23:59:59<\/td>\n<\/tr>\n<tr>\n<td>Quarter<\/td>\n<td>2021-10-01 00:00:00<\/td>\n<td>2021-12-31 23:59:59<\/td>\n<\/tr>\n<tr>\n<td>Year<\/td>\n<td>2021-01-01 00:00:00<\/td>\n<td>2021-12-31 23:59:59<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div style=\"background-color: #ddeaff; border-left: 6px solid #0072b3; padding: 12px;\">\n<p>Use Minute and Hour units only for Datetime input.<\/p>\n<\/div>\n\n\n<p><span style=\"color:#64c6ca;\">date<\/span> &#8211; input the anchor date value.&nbsp; It can be a date or datetime only.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: yes<\/li><\/ul>\n\n\n<div style=\"background-color: #ddeaff; border-left: 6px solid #0072b3; padding: 12px;\">\n<p>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<\/p>\n<p>When the input is a datetime, the output is a datetime as well.<\/p>\n<\/div>\n\n\n<p><span style=\"color:#b197cb;\">offset<\/span> &#8211; input the number of selected time units to offset dates in the result.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Required: no<\/li><\/ul>\n\n\n\n<p>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:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-7c6bb901d7de4fefa92ca5b1a3bc6d89.png\" alt=\"\" class=\"wp-image-513\" width=\"730\" height=\"244\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-7c6bb901d7de4fefa92ca5b1a3bc6d89.png 946w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-7c6bb901d7de4fefa92ca5b1a3bc6d89-300x100.png 300w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-7c6bb901d7de4fefa92ca5b1a3bc6d89-768x257.png 768w\" sizes=\"auto, (max-width: 730px) 100vw, 730px\" \/><\/figure>\n\n\n\n<p><em>E.g. for a date value &#8220;23d February 2021 05:47:00&#8221; with the set time unit to &#8220;Month&#8221; and offset to &#8220;0&#8221;, it returns values &#8220;1st February 2021 00:00:00&#8221; and &#8220;28 February 2021 23:59:59&#8221;<\/em><\/p>\n\n\n\n<p>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<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-6ca93a0d82f34f99b018be928874d99b.png\" alt=\"\" class=\"wp-image-512\" width=\"733\" height=\"240\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-6ca93a0d82f34f99b018be928874d99b.png 840w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-6ca93a0d82f34f99b018be928874d99b-300x98.png 300w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2021\/12\/img-62-6ca93a0d82f34f99b018be928874d99b-768x251.png 768w\" sizes=\"auto, (max-width: 733px) 100vw, 733px\" \/><\/figure>\n\n\n\n<p><em>E.g. for a date value &#8220;23d February 2021 05:47:00&#8221; with the set time unit to &#8220;Month&#8221; and offset to &#8220;1&#8221;, it returns values &#8220;1st March 2021 00:00:00&#8221; and &#8220;31 March 2021 23:59:59&#8221;<\/em><\/p>\n\n\n\n<p><strong>outputs:&nbsp;<\/strong><\/p>\n\n\n\n<p><span style=\"color:#64c6ca;\">start<\/span>&nbsp;&#8211; contains the start date (or date and time) of the interval.&nbsp;<\/p>\n\n\n<p><span style=\"color:#64c6ca;\">end<\/span>&nbsp;&#8211;&nbsp;&nbsp;contains the end date (or date and time) of the interval.&nbsp;<\/p>\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2022\/01\/img-62-a2971f936a8b4a7bb65bd300b52581ae-1024x391.png\" alt=\"\" class=\"wp-image-806\" width=\"754\" height=\"288\" srcset=\"https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2022\/01\/img-62-a2971f936a8b4a7bb65bd300b52581ae-1024x391.png 1024w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2022\/01\/img-62-a2971f936a8b4a7bb65bd300b52581ae-300x115.png 300w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2022\/01\/img-62-a2971f936a8b4a7bb65bd300b52581ae-768x293.png 768w, https:\/\/logicbuilder.integroscrm.com\/help\/wp-content\/uploads\/2022\/01\/img-62-a2971f936a8b4a7bb65bd300b52581ae.png 1213w\" sizes=\"auto, (max-width: 754px) 100vw, 754px\" \/><\/figure>\n<div style=\"text-align:left\" class=\"yasr-auto-insert-visitor\"><!--Yasr Visitor Votes Shortcode--><div id='yasr_visitor_votes_804' class='yasr-visitor-votes'><div class=\"yasr-custom-text-vv-before yasr-custom-text-vv-before-804\">Click to rate this post!<\/div><div id='yasr-vv-second-row-container-17bbfe9bb6709' \n                                        class='yasr-vv-second-row-container'><div id='yasr-visitor-votes-rater-17bbfe9bb6709'\n                                      class='yasr-rater-stars-vv'\n                                      data-rater-postid='804' \n                                      data-rating='0'\n                                      data-rater-starsize='24'\n                                      data-rater-readonly='false'\n                                      data-rater-nonce='fa81b01ba5' \n                                      data-issingular='false'\n                                    ><\/div><div class=\"yasr-vv-stats-text-container\" id=\"yasr-vv-stats-text-container-17bbfe9bb6709\"><svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" width=\"20\" height=\"20\" \n                               class=\"yasr-dashicons-visitor-stats\"\n                               data-postid=\"804\" \n                               id=\"yasr-stats-dashicon-17bbfe9bb6709\">\n                            <path d=\"M18 18v-16h-4v16h4zM12 18v-11h-4v11h4zM6 18v-8h-4v8h4z\"><\/path>\n                          <\/svg><span id=\"yasr-vv-text-container-17bbfe9bb6709\" class=\"yasr-vv-text-container\">[Total: <span id=\"yasr-vv-votes-number-container-17bbfe9bb6709\">0<\/span>  Average: <span id=\"yasr-vv-average-container-17bbfe9bb6709\">0<\/span>]<\/span><\/div><div id='yasr-vv-loader-17bbfe9bb6709' class='yasr-vv-container-loader'><\/div><\/div><div id='yasr-vv-bottom-container-17bbfe9bb6709' class='yasr-vv-bottom-container'><\/div><\/div><!--End Yasr Visitor Votes Shortcode--><\/div>","protected":false},"excerpt":{"rendered":"<p>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), &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/logicbuilder.integroscrm.com\/help\/date-interval\/\"> <span class=\"screen-reader-text\">Date Interval<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","footnotes":""},"tags":[],"class_list":["post-804","page","type-page","status-publish","hentry"],"yasr_visitor_votes":{"number_of_votes":0,"sum_votes":0,"stars_attributes":{"read_only":false,"span_bottom":false}},"_links":{"self":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/comments?post=804"}],"version-history":[{"count":5,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/804\/revisions"}],"predecessor-version":[{"id":1719,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/pages\/804\/revisions\/1719"}],"wp:attachment":[{"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/media?parent=804"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/logicbuilder.integroscrm.com\/help\/wp-json\/wp\/v2\/tags?post=804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}