This week's book giveaway is in the JDBC and Relational Databases forum.
We're giving away four copies of Murach's MySQL and have Joel Murach on-line!
See this thread for details.
Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
    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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

java calneder example

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
I have situation where I need to calculate the dates as follows

today
yesterday
last week
last Quarter


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 12/11/2011 to 12/17/2011

And as far as Last quarter concerned

Q1 - January, February, and March
Q2 - April, May, and June
Q3 - July, August, and September
Q4 - October, November, December

if today's date is 12/21/2011

then last quarter would be Q3 07/01/2011 to 09/30/2011.


How do i achieve this with java date or calender class or by any other means.

Thanks In Advance.
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Caculate the 'days' of every month for the year


just use Calendar.add(-days)
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
You've already asked this question here
 
    Bookmark Topic Watch Topic
  • New Topic