5 Replies Latest reply on Apr 2, 2018 8:29 PM by MarkLarvo

    DateTime fields viewed/used as separate Date and Time fields

    MarkLarvo Specialist

      The existing DateTime fields are clumsy and using the arrow keys to move to the time after using the date picker can be a challenge. I was looking for something like the date and time fields in a MS outlook meeting request where you can quickly tab between fields and type text.

       

      I see that I can create a Date field and a Time field. Is there a way to show a DateTime field as two separate boxes on a form to make data entry easier?

       

      Or is there a function that would take separate Date and Time fields and concatenate them together?

       

      Thanks - Mark.

        • 1. Re: DateTime fields viewed/used as separate Date and Time fields
          scott.phillips SupportEmployee

          Mark,

           

          You can create two new Date/Time fields, one showing Date only and one showing Time only.

          Place those on the form and set the Tab Index.  You can then tab to the field on the form and hand type values or use the picker.

          2 of 2 people found this helpful
          • 2. Re: DateTime fields viewed/used as separate Date and Time fields
            MarkLarvo Specialist

            Scott,

             

            Thanks for that suggestion. This sounds like a step in the right direction.

             

            Sounds like I would then have two fields: (that eventually feed into a 3rd OOTB field)

             

            Due Date          Due Time

            1/1/2018     &    12:30 pm

             

            Most of the system uses Date/Time fields. I want to continue to use that in my list views, record sorting processes and calculations.

             

            Would I then use an expression to combine these two fields into a 3rd field?

             

            (I'm really trying to figure out how much work I would create for myself and new fields if every Date/Time type field was made up of 3 fields.)

             

            Thanks for helping me get my head around this one!

            • 3. Re: DateTime fields viewed/used as separate Date and Time fields
              MarkLarvo Specialist

              The answer to this is to use a Before Save Rule to add the two fields together.

               

              Edit Rules and Calculation Rules DO NOT work.

               

              Before Save Rule

              $(DateTime(FormatDate(DateTime(ToString(ML_DueDate)),  "MM/dd/yyyy") + " " +     FormatDate(ML_DueTime,  "hh:mm tt")))

               

              Fields Used:

              ML_DueDate: Type Binding - Date

              ML_DueTime: Type Binding - Time

              ML_DueDateTime: Type Binding - Date & Time

               

              I have been trying to figure this out for a long time. Thank you to those who have posted!!!

               

              Hope to meet you in Texas in May. Mark

              • 4. Re: DateTime fields viewed/used as separate Date and Time fields
                MarkLarvo Specialist

                To close this post out I am sharing my final solution. As others have posted in similar threads I too had issues with the date+time combo being off by many hours. When I looked from computers in different time zones it seemed even more confusing!

                 

                Jon in support suggested I look at the actual values from SQL to help determine the actual values being read and stored in my date+time combo.

                 

                Here was the final solution:

                 

                date and time combo rule.png

                 

                $(DateTime(FormatDate(DateTime(ToString(AddDays(1,  DueDate))),  "MM/dd/yyyy") + " " +     FormatDate(DueTime,  "hh:mm tt",  "Etc/UTC")))

                 

                To get the correct stored value in SQL I needed to add one day to the date and make sure I was adding the time in the UT timezone. Once the value looked correct in SQL it started to appear in the browser accurately.

                 

                ONE CAVEAT, I was displaying the combo field on my form to check my work and after entering Date and Time and clicking Save the date+time looked wrong. Checking SQL I saw the date+time was correct. The key was to Refresh the record one more time to have the browser transpose the number to my browser timezone. Since we will never display the date/time combo box with the date and time boxes I think we are going to be ok.

                 

                Hope this helps those struggling with this same issue.

                • 5. Re: DateTime fields viewed/used as separate Date and Time fields
                  MarkLarvo Specialist

                  UPDATE WITH EDITTED RULE FOR 2017.2

                   

                  In prior posts I was testing in our dev version of 2015.2. Today I ran into a daylight saving time issue with 2015.2 where it was saving the time in regular time (one hour greater) I decided to see if our current version of 2017.2 had the same issue.

                   

                  IT DOES NOT!!!! YAY!

                   

                  I did find that I needed to adjust my Before Save Business rule and remove the "etc/UTC" time storage parameter. Intial testing shows this working very well and with it recalculating crossing over to different dates  when people are in different time zones.

                   

                  Here is the adjusted Business Rule: our fields are in red text

                   

                  $(DateTime(FormatDate(DateTime(ToString(AddDays(1,  KE_NeedByDate))),  "MM/dd/yyyy") + " " +    FormatDate(KE_NeedByTime,  "hh:mm tt")))

                   

                  Once the users see this I will likely have to convert all of our form fields. LOL.