Shri G Posted January 31, 2023 Share Posted January 31, 2023 Hi All,I have to find the difference between two timestamp columns into days. Please find attached data for your reference.First column is end date and second column is start date I tried with Datediff("days",[start date], [end date]) but for some values it is giving negative value.tried with if(dayofyear([sTART DATE])=dayofyear([END DATE]),0,(Integer(DateDiff("day",[sTART DATE],[END DATE]) / 7) * 5) + DayOfWeek([END DATE]) - DayOfWeek([sTART DATE]) + (if((DayOfWeek([END DATE]) - DayOfWeek([sTART DATE]))<0,5,0))) but getting negative values for some data.Can somebody please help me with?Thanks in advance! Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted January 31, 2023 Share Posted January 31, 2023 Hello,Could you please post an example of a specific start and end date that resulted (incorrectly, i.e where the end date is after the start date) in a negative value for Datediff("days",[start date], [end date])? Link to comment Share on other sites More sharing options...
Shri G Posted January 31, 2023 Author Share Posted January 31, 2023 Hi Fredrik,Here is the data, End Date and Start date Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted January 31, 2023 Share Posted January 31, 2023 Thank you. Could you please paste an example of a specific start and end date (that resulted in a negative datediff value) as text here so we can test the exact values you have? Link to comment Share on other sites More sharing options...
Shri G Posted January 31, 2023 Author Share Posted January 31, 2023 Hi Fredrik,Please find attached doc Link to comment Share on other sites More sharing options...
Fredrik Rosell Posted January 31, 2023 Share Posted January 31, 2023 Thank you!So, here are the datesEnd Date Start Date 01/11/20 06:34 PM 10/03/20 12:00 PM10/05/20 06:33 PM 06/29/21 12:00 PM04/17/19 03:03 PM 01/02/20 11:00 AMSo the format (date part) appears to be DD/MM/YY. The start dates here are AFTER the end dates, which would indeed (this is expected) result in negative for Datediff("days",[start date], [end date]).What result were you looking for, when the start dates are after the end dates? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now