The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Offset with GMT

Posted by fali on December 01, 2001 at 7:13 AM

Instantiate java.util.Date...convert it into msecs using getTime()fn .Then add whatever offset msecs u have got to this.

Eg
Date currentdate=new java.util.Date();
longdt=currentdate.getTime();
totalmsec=longdt+offsetmsec;

Date newDt = new Date();
newDt.setTime(totalmsec);

System.out.println("newDt " + newDt);

This will give u the date u reqd.



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us