Expression Column DateDif

Expression Columns do not support DateDif - this is a different date function than the DayDiff function which is not good enough for what I need.

I need to display the Days Hours and Minutes difference between 2 Date/Time Columns and cant seem to do that without the DateDif function unless anyone has any pointers?

Something similar to =DATEDIF(A3, B3, "y") &" years "&DATEDIF(A3, B3, "ym") &" months " &DATEDIF(A3, B3, "md") &" days" would work in excel so is the only way to do this calculation in the SQL?

3 Replies

DG Dhivyabharathi Govindaraj Syncfusion Team May 7, 2020 12:19 PM UTC

Hi Dave, 
 
We are having DateDiff function in our Bold BI application but we don’t have that support in our Classic Platform. As of now if you want to show the number of days present between two dates in our classic Desktop application, then you can use DayDiff Expression. 
 
If you want to find the hours/ minutes difference between two dates. Please follow below steps. 
 
  1. If you want to calculate the minute difference between the two dates which are in same date then kindly use below formula,
                     Expression 1 : DATEPART(Hour,[date1])*60DATEPART(Minute,[date1])   
                     Expression 2: DATEPART(Hour,[date2])*60DATEPART(Minute,[date2])   
                     Expression 3: [Expression1]-[Expression2  
             Here Expression 3 will give minute difference.   
  
  1. If you want to calculate the minute difference between two different dates then kindly use below formula,
                  Expression 1: DATEPART(Hour,[date1])*60DATEPART(Minute,[date1])   
                  Expression 2: DATEPART(Hour,[date2])*60DATEPART(Minute,[date2])   
                  Expression 3: DAYDIFF([date1],[date2])   
                  Expression 4: ([Expression1]-[Expression2])+[Expression3]*24*60   
             Here Expression 4 will gives the minute difference result    
   
Note: In both steps, Expression1 and Expression 2 are same.   
   
Please refer below screen shot,   
 
 
 
By the same way, you can calculate hours difference also. Otherwise you can use DateDiff fuction directly in your query mode if you are using server type connections. 
 
Kindly let us know if you need any further assistance. 
 
Regards, 
Dhivya 



DB Dave Ball May 7, 2020 12:47 PM UTC

Thank you for the reply, we will be moving to Bold BI soon so that will help.


DG Dhivyabharathi Govindaraj Syncfusion Team May 7, 2020 01:18 PM UTC

Hi Dave, 
 
Thanks for your reply. 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Dhivya 


Loader.
Up arrow icon