| Author | 
		  Message
		 | 
		
		  | Meetraj | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 5:46 am    Post subject: Query on Format of current_timestamp | 
				     | 
			   
			 
		   | 
		
		
		    Novice
 
 Joined: 02 Jul 2005 Posts: 18 Location: India. 
  | 
		  
		    
			  
				Hi Every body,
 
 
           In one of my scenario i got a situation like i have to format my date format as MMddyy_hhmmss_sss.I tried up to some extent and i am getting output as '20050831_092353_679' using string manipulation functions.Now,my requirement is to move the year field to the end of date field.So please suggest me a way to solve the problem.
 
 
 
Thank You. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | wschutz | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 5:55 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Jedi Knight
 
 Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired) 
  | 
		  
		    
			  
				Interesting format ...  you can use substring to pick out and then re-assemble the string into that format.   _________________ -wayne | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JT | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 6:00 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Padawan
 
 Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT. 
  | 
		  
		    
			  
				| Post the ESQL you developed to create '20050831_092353_679' . | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Balakrishna | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 6:04 am    Post subject: Query on Format of current_timestamp | 
				     | 
			   
			 
		   | 
		
		
		   Newbie
 
 Joined: 30 Jun 2005 Posts: 5
  
  | 
		  
		    
			  
				--Set the TimeStamp in RequiredFormat. <Data>regtfe</Data>	
 
	SET cNewTimeStampMM = SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 17 FOR 2);
 
	SET cNewTimeStampDD = SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 20 FOR 2);
 
	SET cNewTimeStampYY = SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 12 FOR 4);
 
	SET cTimeStamp = SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 23 FOR  ;
 
	SET cNewTimeStamphhmmss = REPLACE(REPLACE(cTimeStamp,':',''),':','');
 
	SET cNewTimeStampSSS = SUBSTRING(CAST(CURRENT_TIMESTAMP AS CHAR) FROM 32 FOR 3);
 
	
 
 
--Creating the Target FileName with CurrentTimeStamp like MMDDYY_hhmmss_SSS
 
 
SET cNewDate=cNewTimeStampMM ||cNewTimeStampDD|| cNewTimeStampYY||'_'||cNewTimeStamphhmmss ||'_'||cNewTimeStampSSS; | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Meetraj | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 6:06 am    Post subject: Thank you | 
				     | 
			   
			 
		   | 
		
		
		    Novice
 
 Joined: 02 Jul 2005 Posts: 18 Location: India. 
  | 
		  
		    
			  
				
   
	| wschutz wrote: | 
   
  
	Interesting format ...  you can use substring to pick out and then re-assemble the string into that format.   | 
   
 
 
 
 
I want a method which won't effect to performance of my code.The method which is specified will definitely work fine as i already tried that one appending each and every field as i required after extrcating from timestamp.
 
 
Thank you though. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JT | 
		  
		    
			  
				 Posted: Wed Aug 31, 2005 6:13 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Padawan
 
 Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT. 
  | 
		  
		    
			  
				| You can also use the Extract function to constitute your unique date/time stamp. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |