Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how to get date + 5 minute

Posted on 2006-06-19
2
Medium Priority
?
210 Views
Last Modified: 2010-04-01
the following code do the current date time from my server, however, I want to get (time + 5 minutes) .

Thanks

Date fDate= new Date();
TimeZone gmtZone = TimeZone.getTimeZone("EST");
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
format.setTimeZone(gmtZone);
String dateString = format.format(fDate);
0
Comment
Question by:salasadi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 15

Accepted Solution

by:
bpmurray earned 200 total points
ID: 16937650
Try something like:

   Calendar myCal = Calendar.getInstance();
   myCal.add(Calendar.MINUTE, 5);
   Date fDate = myCal.getTime();
0
 
LVL 5

Expert Comment

by:muktajindal
ID: 17072201
           Date fDate= new Date();
            //
            long five = fDate.getTime() + 5*60*1000;
            fDate = new Date(five);
            //
            TimeZone gmtZone = TimeZone.getTimeZone("EST");
            SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
            format.setTimeZone(gmtZone);
            String dateString = format.format(fDate);
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
On September 18, Experts Exchange launched the first installment of the Help Bell, a new feature for Premium Members, Team Accounts, and Qualified Experts. The Help Bell will serve as an additional tool to help teams increase question visibility.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

722 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