Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
Hi,
I need to calculate the Age of the tickets. I have tried using the Age function and Networkdays. Since Age function gives the result in years and Networkdays gives the number of working days excluding the weekends i am not able to use the above functions... Is there any other way i can calculte the Age of the tickets.
Regards,xxx
 
					
				
		
 johnw
		
			johnw
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If something was opened yesterday and closed today, do you want to say it was open for 1 day, or 2 days? If 1 day, use floor(CloseDate - OpenDate). If 2 days, use ceil(CloseDate - OpenDate). This isn't a question of accuracy. It is a requirements question, a question about what YOU want to see.
Edit: Wait, no, ceil() is wrong. If they're straight dates, you'll get 1 with both floor() and ceil(). If they're timestamps, you'll get 0 or 1 with floor(), 1 or 2 with ceil(). So for dates, it's just CloseDate - OpenDate or CloseDate - OpenDate + 1. For timestamps, probably daystart(CloseDate) - daystart(OpenDate) or daystart(CloseDate) - daystart(OpenDate) + 1. Mind you, if I had timestamps, and I wanted dates, I'd just create dates out of the timestamps, and then use the dates in the calculation. Or maybe you want straight timestamp calculations instead of date calculations. So many possibilities. Mainly I just wanted to point out that my answer was wrong.
.png) 
					
				
		
 Miguel_Angel_Ba
		
			Miguel_Angel_BaHello,
You can use interval() and format the output to show minutes, hours, days...
Regards.
 
					
				
		
 rwunderlich
		
			rwunderlich
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If you want to count all days, just subtract start from end like:
CloseDate - OpenDate;
You can format as whole number of days like
floor(CloseDate - OpenDate)
-Rob
 
					
				
		
Thanks for your response Miguel A. Baeyens & Rob Wunderlich....
Hi Rob,
If i am going to use (CloseDate - OpenDate) or floor(CloseDate - OpenDate) . do i need to add +1 with result.Normally in Sql server if u are using datediff then +1 should be added to the result to get the accurate date diff...........
Regards,xxx
 
					
				
		
 johnw
		
			johnw
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		If something was opened yesterday and closed today, do you want to say it was open for 1 day, or 2 days? If 1 day, use floor(CloseDate - OpenDate). If 2 days, use ceil(CloseDate - OpenDate). This isn't a question of accuracy. It is a requirements question, a question about what YOU want to see.
Edit: Wait, no, ceil() is wrong. If they're straight dates, you'll get 1 with both floor() and ceil(). If they're timestamps, you'll get 0 or 1 with floor(), 1 or 2 with ceil(). So for dates, it's just CloseDate - OpenDate or CloseDate - OpenDate + 1. For timestamps, probably daystart(CloseDate) - daystart(OpenDate) or daystart(CloseDate) - daystart(OpenDate) + 1. Mind you, if I had timestamps, and I wanted dates, I'd just create dates out of the timestamps, and then use the dates in the calculation. Or maybe you want straight timestamp calculations instead of date calculations. So many possibilities. Mainly I just wanted to point out that my answer was wrong.
 
					
				
		
Thanks for your clarification....
valid point we have to think about it.
