Solved

Subtracting 1 day from date...

Posted on 2004-04-27
2
329 Views
Last Modified: 2010-03-31
All, I am displaying the current date

new java.text.SimpleDateFormat("yyyy-MM-dd").format (new java.util.Date ());

I want to display current date - 1 and/or +1.

How?
0
Comment
Question by:greedy1
  • 2
2 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 20 total points
ID: 10929291
Calendar cal = Calendar.getInstance();
cal.setTime(yourDate);
cal.add(Calendar.DATE, -1);
String newDate = yourFormat.format(cal.getTime());
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 10929932
8-)
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now