Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / February 2004

Tip: Looking for answers? Try searching our database.

hsqldb date/timestamp arithmetic

Thread view: 
tk - 26 Feb 2004 00:24 GMT
Can someone provide an example of date or timestamp arithmetic using
HSQLDB. How can you add one day or 2 minutes or whatever to a date.
Thanks.
Mladen Adamovic - 26 Feb 2004 13:43 GMT
TIMESTAMP in HSQLDB in java.sql.Timestamp object.

So assume you have java.sql.TimeStamp ts object.
To add one day you do
ts.setTime(ts.getTime()+
   /* no of milisecunds in one secund */ 100*
   /* number of secunds in one minute */ 60*
  /* number of minutes in one hour */ 60*
 /* number of hours in one day */ 24);

Hope it helps, mladen
> Can someone provide an example of date or timestamp arithmetic using
> HSQLDB. How can you add one day or 2 minutes or whatever to a date.
> Thanks.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.