| Author | 
		  Message
		 | 
		
		  | tsuru | 
		  
		    
			  
				 Posted: Fri Aug 04, 2006 3:49 pm    Post subject: How to get day in week from CURRENT_DATE? | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Nov 2005 Posts: 24 Location: São Paulo 
  | 
		  
		    
			  
				Anyone knows how to get day in week from CURRENT_DATE?
 
 
I´m trying this but it returns nothing:
 
DECLARE dayInWeek CHAR;
 
SET dayInWeek = CAST(CURRENT_DATE AS CHAR FORMAT 'EEE');
 
 
Thanks | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jbanoop | 
		  
		    
			  
				 Posted: Sat Aug 05, 2006 12:20 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Chevalier
 
 Joined: 17 Sep 2005 Posts: 401 Location: SC 
  | 
		  
		    
			  
				try:
 
 cast(current_date as char format 'e')
 
 
Regards,
 
Anoop | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tsuru | 
		  
		    
			  
				 Posted: Sun Aug 06, 2006 9:13 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Nov 2005 Posts: 24 Location: São Paulo 
  | 
		  
		    
			  
				| didn´t work. anymore ideas? | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | SKK | 
		  
		    
			  
				 Posted: Sun Aug 06, 2006 9:24 pm    Post subject: Extract | 
				     | 
			   
			 
		   | 
		
		
		    Acolyte
 
 Joined: 09 May 2005 Posts: 67
  
  | 
		  
		    
			  
				Try 
 
EXTRACT(DAYOFWEEK FROM CURRENT_DATE);
 
 
where
 
 
Day of the week: 
 
Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7. _________________ Regards,
 
SKK | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Nigelg | 
		  
		    
			  
				 Posted: Mon Aug 07, 2006 1:26 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Grand Master
 
 Joined: 02 Aug 2004 Posts: 1046
  
  | 
		  
		    
			  
				In C, this will do it:
 
 
   
	| Code: | 
   
  
	
 
t = (d+=m<3?y--:y-2,23*m/9+d+4+y/4-y/100+y/400)%7; /* Sun = 0 */
 
 | 
   
 
 _________________ MQSeries.net helps those who help themselves.. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | jbanoop | 
		  
		    
			  
				 Posted: Mon Aug 07, 2006 1:59 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Chevalier
 
 Joined: 17 Sep 2005 Posts: 401 Location: SC 
  | 
		  
		    
			  
				u shld specify which version you are on ...
 
there is a lot of diff b/w v 5 and v 6 casts and date time manipulations..
 
Anoop | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | tsuru | 
		  
		    
			  
				 Posted: Mon Aug 07, 2006 1:48 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		   Novice
 
 Joined: 25 Nov 2005 Posts: 24 Location: São Paulo 
  | 
		  
		    
			  
				Didn´t work too.
 
I´m using Broker 5.0 CSD6. | 
			   
			 
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Bill.Matthews | 
		  
		    
			  
				 Posted: Mon Aug 07, 2006 6:19 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    Master
 
 Joined: 23 Sep 2003 Posts: 232 Location: IBM (Retired) 
  | 
		  
		    
		   | 
		
		
		  | Back to top | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |