• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

Question regarding Calendar in Java

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have a question regarding the use of Calendar.

User will give year (e.g 2006,2007, etc.) as input. I have to find out the "date" of the "first friday" of each month through out the year. Then I have to display thaose as result.
How can I do that? Can anyone please help me for solving this problem?
Can any one please give me any hint by sample program code?

Thanks
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check this code.



[ March 01, 2007: Message edited by: Ibrahim AlShehri ]

[ March 01, 2007: Message edited by: Ibrahim AlShehri ]
[ March 01, 2007: Message edited by: Ibrahim AlShehri ]
 
Soumya Ghosh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot.
 
Marshal
Posts: 82459
594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

NITHYA P wrote:. . . the Calendar class is used to work with dates and time . . . how to use the Calendar class . . .

There is a very simple answer to when you should use Calendar, and its predecessor, Date: never. It may occasionally be necessary to use this class when working with databases, however.
Look in the Java® Tutorials always use the datatypes described there. Beginners may find that they spend a long time only using these three classes:- 1 2 3. The documentation for the time package says,

. . . most applications can begin with just five date/time types.

The thread you have found was written seven years before the java.time package was introduced.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic