How to calculate the minimum and maximum date from multiple date controls and display the value in the correct date format

  • 29 December 2020
  • 0 replies
  • 43 views

Badge +8

Topic

How to calculate the minimum and maximum date from multiple date controls and display the value in the correct date format.

 

Instructions

Add a calculated value control to the form and use the below formula.

Calculate maximum date:
formatDate(dateAddMinutes(date(1,1,1970,0,0),max([Date control,Date control,Date Control])/1000/60), "MM/dd/yyyy")

Calculate minimum date:
formatDate(dateAddMinutes(date(1,1,1970,0,0),min([Date control,Date control,Date Control])/1000/60), "MM/dd/yyyy")
 

Additional Information

- The max function gets the max date but in the wrong format: Unix epoch, which is the number of milliseconds since January 1, 1970.

- Divide that by 1000 to get seconds then by 60 to get minutes, then add those minutes to January 1, 1970 using the dateAddMinutes function. Change the two 0's in this function based on the timezone.

- Use formatDate to get the string version of the date value.


0 replies

Be the first to reply!

Reply