{"id":2882,"date":"2018-07-18T21:53:22","date_gmt":"2018-07-19T01:53:22","guid":{"rendered":"http:\/\/kenhamady.com\/cru\/?p=2882"},"modified":"2018-07-18T21:59:53","modified_gmt":"2018-07-19T01:59:53","slug":"first-day-of-the-calendar-quarter","status":"publish","type":"post","link":"https:\/\/kenhamady.com\/cru\/archives\/2882","title":{"rendered":"First day of the calendar quarter"},"content":{"rendered":"<p>Finding the the beginning date for most date periods is simple. For example:<br \/>\nFirst day of this Year: <code>Minimum (YearToDate)<\/code><br \/>\nFirst day of this month: <code>Minimum (MonthToDate)<\/code><br \/>\nFirst day of Last month: <code>Minimum (LastFullMonth)<\/code><br \/>\nFirst day of this week: <code>Minimum (WeekToDate)<\/code><\/p>\n<p>But there isn&#8217;t a comparably simple way to get the first day of the current calendar quarter. So if you ever need that calculation you can use the following formula:<\/p>\n<p><code>Local numberVar x := Month (CurrentDate);<br \/>\nDate (<br \/>\nYear(CurrentDate), \/\/Year<br \/>\nif x &gt; 9 then 10 else<br \/>\nif x &gt; 6 then 7 else<br \/>\nif x &gt; 3 then 4 else 1, \/\/Month<br \/>\n1 \/\/Day<br \/>\n)<\/code><\/p>\n<p>If you want the beginning of the quarter related to a field other than today&#8217;s date you can substitute a database field, formula or parameter in the two places that say &#8220;CurrentDate&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finding the the beginning date for most date periods is simple. For example: First day of this Year: Minimum (YearToDate) First day of this month: Minimum (MonthToDate) First day of Last month: Minimum (LastFullMonth) First day of this week: Minimum (WeekToDate) But there isn&#8217;t a comparably simple way to get the first day of the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-2882","post","type-post","status-publish","format-standard","hentry","category-formulas"],"_links":{"self":[{"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/posts\/2882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/comments?post=2882"}],"version-history":[{"count":0,"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/posts\/2882\/revisions"}],"wp:attachment":[{"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/media?parent=2882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/categories?post=2882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenhamady.com\/cru\/wp-json\/wp\/v2\/tags?post=2882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}