Solved

how to get date + 5 minute

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSP Popup page 2 116
attribute vs parameter and setter vs add method 17 86
I am having a difficulty creating a responsive Page for my website. 10 86
immutable object concept 5 119
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
Each year, investment in cloud platforms grows more than 20% (https://www.immun.io/hubfs/Immunio_2016/Content/Marketing/Cloud-Security-Report-2016.pdf?submissionGuid=a8d80a00-6fee-4b85-81db-a4e28f681762) as an increasing number of companies begin to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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