2 Replies Latest reply on Dec 8, 2018 12:22 PM by Don Wise

    Create Datetime Blocks....


      Good afternoon,


      I am trying to create time blocks / groups


      Example:  a datetime field that is formatted  1/1/2018 12:00:00 AM....


      i need to create groups that would be:

      IF datetime field is >= 1/1/2018 12:00:00 AM and the datetime field is <= 3:00:00 AM THEN "Midnight to 3 AM" ELSEIF datetime field>= 3:01:00 AM and the datetime field <= 6:00:00 AM THEN "3 AM to 6 AM"  and so on to "END" .... 


      Hopefully that example explains what I am trying to do, thanks in advance.

        • 1. Re: Create Datetime Blocks....
          Ritesh Bisht

          Hi Steve,


          Guess it should help you.

          Screenshot 2018-12-09 at 1.48.52 AM.png



          Copy here --->

          if   DATEPART('hour',[Order Date] ) >=0 and



          DATEPART('hour',[Order Date] ) <=3  then 'Midnight to 3 AM'







          Please mark the answer as HELPFUL and CORRECT if it helps you so that it can help others as well

          1 of 1 people found this helpful
          • 2. Re: Create Datetime Blocks....
            Don Wise

            Hi Steve,

            You can try a calculation similar to this:


            //defines 12a-3a shift

            IF DATEPART('hour', [Your Timestamp]) >=0 AND DATEPART('hour', [Your Timestamp]) <=3

            THEN "12am-3am"


            //defines 3a-6a shift

            ELSEIF DATEPART('hour', ([Your Timestamp]) >3  AND DATEPART('hour', [Your Timestsamp]) <=6

            THEN "3am-6am"




            Hope that helps....thx, Don

            2 of 2 people found this helpful