ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Getting Day_Of_Week from Calendar Class

Post new topic  Reply to topic
 Getting Day_Of_Week from Calendar Class « View previous topic :: View next topic » 
Author Message
72dolfan
PostPosted: Thu Mar 15, 2007 10:23 am    Post subject: Getting Day_Of_Week from Calendar Class Reply with quote

Acolyte

Joined: 02 May 2006
Posts: 53

Hi All,

I'm looking at the CALENDAR Class and trying to figure out how to get the day of the week that a certain date falls on, but I don't see the method that handles this. I've looked at the DATE Class which uses the getDay method which receives the year, month, and day). However, we have been instructed to use the CALENDAR Class.

Do any of you know which method in the Calendar Class returns only the number value for the day of the week?

Thanks!!!!!
Bill
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 10:31 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

72dolfan wrote:
Hi All,

I'm looking at the CALENDAR Class and trying to figure out how to get the day of the week that a certain date falls on, but I don't see the method that handles this. I've looked at the DATE Class which uses the getDay method which receives the year, month, and day). However, we have been instructed to use the CALENDAR Class.

Do any of you know which method in the Calendar Class returns only the number value for the day of the week?

Thanks!!!!!
Bill



This code should work.

Code:

Calendar rightNow = Calendar.getInstance();
int dayofweek= rightNow.get(Calendar.DAY_OF_WEEK );



_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
72dolfan
PostPosted: Thu Mar 15, 2007 10:38 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Acolyte

Joined: 02 May 2006
Posts: 53

marcin.kasinski wrote:
72dolfan wrote:
Hi All,

I'm looking at the CALENDAR Class and trying to figure out how to get the day of the week that a certain date falls on, but I don't see the method that handles this. I've looked at the DATE Class which uses the getDay method which receives the year, month, and day). However, we have been instructed to use the CALENDAR Class.

Do any of you know which method in the Calendar Class returns only the number value for the day of the week?

Thanks!!!!!
Bill



This code should work.

Code:

Calendar rightNow = Calendar.getInstance();
int dayofweek= rightNow.get(Calendar.DAY_OF_WEEK );




I thought about that, but what if I wanted to supply a specific date (year, month, & day) in time and get back the day of the week instead of the current date, which is what I believe the code you specified does?

Thanks,
Bill
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 10:41 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

72dolfan wrote:


I thought about that, but what if I wanted to supply a specific date (year, month, & day) in time and get back the day of the week instead of the current date, which is what I believe the code you specified does?

Thanks,
Bill



Have you tried set method of Calendar class ?
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
72dolfan
PostPosted: Thu Mar 15, 2007 10:48 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Acolyte

Joined: 02 May 2006
Posts: 53

marcin.kasinski wrote:
72dolfan wrote:


I thought about that, but what if I wanted to supply a specific date (year, month, & day) in time and get back the day of the week instead of the current date, which is what I believe the code you specified does?

Thanks,
Bill



Have you tried set method of Calendar class ?


So if I issue the following;

set (int year, int month, int date)

and then run the code you supplied, that woudl do the trick?

Also, if I didn't want any time values (just looking for the day of the week for whatever date I specify) would I issue the clear method before the set and get?

Thanks,
Bill
Back to top
View user's profile Send private message
marcin.kasinski
PostPosted: Thu Mar 15, 2007 10:54 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Sentinel

Joined: 21 Dec 2004
Posts: 850
Location: Poland / Warsaw

72dolfan wrote:



So if I issue the following;

set (int year, int month, int date)

and then run the code you supplied, that woudl do the trick?

Also, if I didn't want any time values (just looking for the day of the week for whatever date I specify) would I issue the clear method before the set and get?

Thanks,
Bill



You can set everything

set(int year, int month, int date, int hour, int minute, int second)

You can use clear.

Pleas read this http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html
_________________
Marcin
Back to top
View user's profile Send private message Visit poster's website
72dolfan
PostPosted: Thu Mar 15, 2007 10:59 am    Post subject: Re: Getting Day_Of_Week from Calendar Class Reply with quote

Acolyte

Joined: 02 May 2006
Posts: 53

marcin.kasinski wrote:
72dolfan wrote:



So if I issue the following;

set (int year, int month, int date)

and then run the code you supplied, that woudl do the trick?

Also, if I didn't want any time values (just looking for the day of the week for whatever date I specify) would I issue the clear method before the set and get?

Thanks,
Bill



You can set everything

set(int year, int month, int date, int hour, int minute, int second)

You can use clear.

Pleas read this http://java.sun.com/j2se/1.4.2/docs/api/java/util/Calendar.html


The link you provided is where I was looking and getting my info.

I think its pretty clear now.

Thanks for all your help!!!!!!!!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Getting Day_Of_Week from Calendar Class
Jump to:  



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
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.