| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| vasukavi Beginner
 
 
 Joined: 17 May 2006
 Posts: 1
 Topics: 1
 
 
 | 
			
				|  Posted: Fri Aug 11, 2006 9:17 am    Post subject: Convert a Date into hours and minutes in DB2 SQL query... |   |  
				| 
 |  
				| Hi.. 
 I have two dates and would like to find out the difference of these dates in hours and minutes..
 
 For example: I have a Report date : '2006/08/07 09:30:21' and Received date  '2006/08/06 08:00:00'.. I want to find out the dfference in hours and minutes..
 
 Is there any function in DB2 to get this? I wnat to write a query to get this and I really appreciate your help.
 
 I have looked into the previous questions on the forum but could not find espeecially converting a date into hours and minutes..
 
 Thank you and have a great day.
 
 Vasu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| kolusu Site Admin
 
  
 
 Joined: 26 Nov 2002
 Posts: 12394
 Topics: 75
 Location: San Jose
 
 | 
			
				|  Posted: Fri Aug 11, 2006 10:14 am    Post subject: |   |  
				| 
 |  
				| vasukavi, 
 The difference between two 2 timestamps gets tricker in terms of hours and minutes is way too complicated with the leap years and days in a month using just the SQl.
 
 How about the using the Language environment calls as shown in here. The link has an example of calculating the difference between 2 timestamps.
 
 http://www.mvsforums.com/helpboards/viewtopic.php?t=2261
 
 Hope this helps...
 
 Cheers
 
 Kolusu
 _________________
 Kolusu
 www.linkedin.com/in/kolusu
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  | 
	
		|  |