Solved

how to get date + 5 minute

Posted on 2006-06-19
2
202 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 50 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

Independent Software Vendors: 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

Suggested Solutions

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 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