Solved

how to get date + 5 minute

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
A Short Story about the Best File Recovery Software – Acronis True Image 2017
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

747 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

13 Experts available now in Live!

Get 1:1 Help Now