| Author | 
		  Message
		 | 
		
		  | N | 
		  
		    
			  
				 Posted: Wed Oct 17, 2007 10:14 pm    Post subject: How to convert timestamp format | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 21 Jul 2007 Posts: 64
  
  | 
		  
		    
			  
				Hi,
 
 
How to convert current timestamp to yyyymmddhhmmssmm.
 
 
Please help.Thanks. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | elvis_gn | 
		  
		    
			  
				 Posted: Wed Oct 17, 2007 10:33 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Padawan
 
 Joined: 08 Oct 2004 Posts: 1905 Location: Dubai 
  | 
		  
		    
			  
				Hi N,
 
 
What have you tried as of now ?
 
 
Did you try declaring a variable with the 'FORMAT' clause ?
 
 
 
Regards. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | N | 
		  
		    
			  
				 Posted: Wed Oct 17, 2007 10:39 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 21 Jul 2007 Posts: 64
  
  | 
		  
		    
			  
				Hi,
 
 
Currently i use 
 
SET OutputRoot.MRM.DATE  = CURRENT_TIMESTAMP | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | shalabh1976 | 
		  
		    
			  
				 Posted: Thu Oct 18, 2007 4:51 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | N | 
		  
		    
			  
				 Posted: Thu Oct 18, 2007 10:46 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 21 Jul 2007 Posts: 64
  
  | 
		  
		    
			  
				Hi,
 
 
 
Thanks for your reply. Following code is working for V6 only. Im using V5.
 
 
DECLARE CurrentTimeStamp TIMESTAMP; 
 
SET CurrentTimeStamp = TIMESTAMP 'yyyy-MM-dd-HH';
 
 
   | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | N | 
		  
		    
			  
				 Posted: Thu Oct 18, 2007 11:50 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Acolyte
 
 Joined: 21 Jul 2007 Posts: 64
  
  | 
		  
		    
			  
				Hi,
 
 
DECLARE target CHARACTER;
 
SET target = CAST(CURRENT_TIMESTAMP AS TIMESTAMP FORMAT 'yyyyMMddHH');
 
		
 
This also fail. It return whole junk of timestamp.... | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | shalabh1976 | 
		  
		    
			  
				 Posted: Fri Oct 19, 2007 5:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Partisan
 
 Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India 
  | 
		  
		    
			  
				FORMAT in CAST is not supported in V5.
 
You will have to write your own function to do what you want in V5. _________________ Shalabh
 
IBM Cert. WMB V6.0
 
IBM Cert. MQ V5.3 App. Prog.
 
IBM Cert. DB2 9 DB Associate | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |