-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: need help with TO_DATE in sql
PostPosted: Wed Nov 05, 2008 7:09 pm 
Newbie

Joined: Wed Nov 05, 2008 7:04 pm
Posts: 2
suppose I would like to find the 'day of the week' of the first day of the millennium. Could you help me with the code? I've tried so many ways.

and I also need help with the code if I would like to list all the Member(table) that were born on the first month of the year.

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 05, 2008 8:25 pm 
Newbie

Joined: Wed Nov 05, 2008 7:59 pm
Posts: 8
To get the day of week for any date, try this code....

Code:
Calendar cal = Calendar.getInstance();
cal.set(2000, 1, 1);
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
String day=null;
switch (dayOfWeek) {
   case Calendar.SUNDAY:
   day = "Sunday";
   case Calendar.MONDAY:
   day = "Monday";
   //etc
}
System.out.println(day);


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 06, 2008 6:11 am 
Newbie

Joined: Wed Nov 05, 2008 7:04 pm
Posts: 2
thank you very much
I can't find the way to search the month in the table without giving a specific year by using To_date or To_char


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.