aspose file tools
The moose likes Java in General and the fly likes What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?" Watch "What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?" New topic
Author

What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?

vicky ece
Greenhorn

Joined: Jan 03, 2012
Posts: 17
What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?why i am getting different output for the same date...



Output is : My Uncle BirthDay is going to be on the day :Monday



Output is : My Uncle BirthDay is going to be on the day :SUNDAY

Why the output varies and the actual date is SUNDAY.. Any idea....
Greg Brannon
Rancher

Joined: Oct 24, 2010
Posts: 380
Have you read the Calendar API? If you're still not sure after reading that, come back and describe your confusion.


Learning Java using Eclipse on OpenSUSE 11.2
Linux user#: 501795
vicky ece
Greenhorn

Joined: Jan 03, 2012
Posts: 17
Greg Brannon wrote:Have you read the Calendar API? If you're still not sure after reading that, come back and describe your confusion.



Thanks for your quick reply i have read Calendar API it is confusing for me , so can you you explain me why i am getting different answer
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 14610

vicky ece wrote: What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?why i am getting different output for the same date...



Output is : My Uncle BirthDay is going to be on the day :Monday



Output is : My Uncle BirthDay is going to be on the day :SUNDAY

Why the output varies and the actual date is SUNDAY.. Any idea....



I believe you are confusing what DAY_OF_WEEK_IN_MONTH actually returns. It didn't return MONDAY. It returned the number 2. So, basically, your uncle's birthday is on a SUNDAY, specifically, the second SUNDAY of the month.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
vicky ece
Greenhorn

Joined: Jan 03, 2012
Posts: 17
Henry Wong wrote:
vicky ece wrote: What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?why i am getting different output for the same date...

So, basically, your uncle's birthday is on a SUNDAY, specifically, the second SUNDAY of the month.

Henry



Thank you sooooo much i got it....
 
 
subject: What is the difference between DAY_OF_WEEK and DAY_OF_WEEK_IN_MONTH.?
 
Threads others viewed
Need to find day of the week
JSP calendar problem
TimeZone conversion problem
How to find day from the week using date format?
Bug with java.util.Calendar
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture