Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: get day of week for the selected date

i have used this  and it show me 6 in console

Calendar rightNow = Calendar.getInstance();
rightNow.set(Calendar.YEAR, 2004);
rightNow.set(Calendar.MONTH, 03);
rightNow.set(Calendar.DATE, 02);

System.out.println("-----------"+rightNow.get(Calendar.DAY_OF_WEEK));

 

Please use plain text.
Developer
simon_hain
Posts: 16,023
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: get day of week for the selected date

Calendar.DAY, not DATE
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: get day of week for the selected date

i use Calendar.DAY, and that shows me error DAY cannot be resolved or is not a field, i did not find Calendar.DAY.
Please use plain text.
Developer
simon_hain
Posts: 16,023
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: get day of week for the selected date

it is
http://www.blackberry.com/developers/docs/7.1.0api/java/util/Calendar.html#DAY_OF_MONTH

i misquoted from memory. It would not hurt if you would look at the API you are trying to use. Maybe it is easier for you to ask here, but looking yourself would help you much better in some cases.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: get day of week for the selected date

still, i'm not able to solve my issue, i used the following and that show me 6 in console
Calendar rightNow = Calendar.getInstance();
rightNow.set(Calendar.YEAR, 2004);
rightNow.set(Calendar.MONTH, 03);
rightNow.set(Calendar.DATE, 02);

System.out.println("----DAY_OF_WEEK-------"+rightNow.get(Calendar.DAY_OF_WEEK));
Please use plain text.
Developer
simon_hain
Posts: 16,023
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: get day of week for the selected date

that is the same code as above, not surprising that it does not work.

replace
rightNow.set(Calendar.DATE, 02);
with
rightNow.set(Calendar.DAY_OF_MONTH, 02);
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: get day of week for the selected date

yes i uesd your code and it shows me 6 in console
Calendar rightNow = Calendar.getInstance();
rightNow.set(Calendar.YEAR, 2004);
rightNow.set(Calendar.MONTH, 03);
rightNow.set(Calendar.DAY_OF_MONTH, 02);

System.out.println("----DAY_OF_WEEK-------"+rightNow.get(Calendar.DAY_OF_WEEK));
Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: get day of week for the selected date

That is correct isn't it?

 

If you wanted to see the value 2, you should have output DAY_OF_MONTH not DAY_OF_WEEK?

Please use plain text.
Super Contributor
Achin
Posts: 425
Registered: ‎01-02-2013
My Device: BOLD 9900
My Carrier: sdvsdvsd

Re: get day of week for the selected date

it shows me 2 in console what does it mean..?
Please use plain text.
Developer
simon_hain
Posts: 16,023
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: get day of week for the selected date

it is the value of http://www.blackberry.com/developers/docs/7.1.0api/java/util/Calendar.html#TUESDAY

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Please use plain text.