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 / First Aid / April 2005

Tip: Looking for answers? Try searching our database.

date function

Thread view: 
Irlan agous - 05 Apr 2005 20:52 GMT
Hello all,
I dont know how to get mysels a date in java.
when i have a date i want to run an sql query to select the payment

also i want to check that after
6 montths the value of payment will be 0 again. So it has to check the date
after 6 months

Irlan
Wannabee - 06 Apr 2005 07:00 GMT
> Hello all,
> I dont know how to get mysels a date in java.
[quoted text clipped - 3 lines]
> 6 montths the value of payment will be 0 again. So it has to check the date
> after 6 months

Maybe this helps? (untested)

java.sql.Date sqldate = new java.sql.Date();
// sqldate.toString() gives a String which can be used in a SQL-statement
// like  ... " WHERE DTE = '" + sqldate.toString() + "' AND " ...
// if the type of the field DTE is DATE

java.util.Calendar cal = new java.util.GregorianCalendar();
cal.setTime(sqldate);
cal.add(java.util.Calendar.MONTH, 6);          // add 6 months
sqldate = cal.getTime();


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.