| Author |
Java date/calender help needed
|
nand rai
Greenhorn
Joined: Feb 17, 2009
Posts: 27
|
|
I have situation where I need to calculate the dates as follows
today
yesterday
last week
last Quarter
quarter to date
how do i achieve this .
say for example if today's date is 12/21/2011
i want to get "Yesterday" as 12/20/2011( this is simple) using calender class
how to achieve the last WEEK and last Quarter?
Thanks In Advance.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5888
|
|
|
Look at Calendar and its add() method.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5888
|
|
Also, TellTheDetails. It's impossible to know what you've tried and what specific problems you had if you don't tell us.
|
 |
nand rai
Greenhorn
Joined: Feb 17, 2009
Posts: 27
|
|
I have updated the question.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5888
|
|
nand rai wrote:I have updated the question.
That really doesn't provide any new information. My first reply still stands. Try it, and if you're still stuck, post back with your attempt and details about what's you're having trouble with.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
nand rai wrote:I have updated the question.
Please don't do that. Whatever changes you make to existing posts may cause any reply to look ridiculous. Just create a new post with the updated information.
Now, define "last week". Is it exactly 7 days ago? Is it the first day of the week? Or what?
Likewise for "last quarter". Would that be July 1st, October 31st, or what?
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Java date/calender help needed
|
|
|