The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000

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:

Adding seconds to timestamp

Posted by Jinesh Jain on July 05, 2001 at 12:02 PM

Hi Kevin,
The simplest way to do it is from the query only using DateADD function you can add 30 seconds, but that may not be feasible solution in your case.
In java to add 30 seconds to timestamp, you will have to use some deprecated methods, first get the seconds using dateMax.getSeconds(), add 30 to that. If the resulting value is greater than 60, shift remainder to minute part and set the seconds using dateMax.setSeconds.
Now as you are shifting remainder(if any) to minute
part, you will have to follow the same procedure till year comes.
Hope it helps.





Replies:

Sponsored Links



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