aspose file tools*
The moose likes Java in General and the fly likes date problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "date problem" Watch "date problem" New topic
Author

date problem

Dipse smith
Greenhorn

Joined: Mar 12, 2008
Posts: 5
I have the day of week (eg monday),week of year (eg 41) and year (eg 2007)
From this I want to calculate the date in the form dd/MM/yyyy but i am not sure how to do this.
Searches on google and such have not provided me with a solution to my problem.
What I attempted to do was take the week of year and find the date of the monday of that week and work from there. However i could not get this to work and was wondering if there was another way.

Thanks in advance for any help.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19543
    
  16

Check out java.util.Calendar, java.util.Date and java.text.(Simple)DateFormat.
In short:
- create a Calendar instance
- set the values of that Calendar instance
- retrieve a Date from that Calendar instance
- create a DateFormat
- format the Date


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 3947
    
  17

Use a Calendar to get a representation of the specific date you need (setting the year, week in year, and day of week fields). Then when you have it configured get a Date object from the Calendar and use DateFormat to output a String in the format you want.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: date problem
 
Similar Threads
How do i get the start and the end date for a perticular week
trouble with date
How to get weeks for a particular year with Calendar object
Holiday in date
How to find day from the week using date format?