Java Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJava Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 18th, 2005, 12:54 PM
harshika harshika is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 24 harshika User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 1 m 33 sec
Reputation Power: 0
Question help please

my application is a web based library system and using java/jasp with tomcat and mysql. i want to know how to get date when adding a book loan to borrower and calculate return date. and i need the java /sql time convertion .
thanks in advance.

Reply With Quote
  #2  
Old July 27th, 2005, 02:58 PM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
If you're talking about converting the java date into a format that can be put in a database, this might be your solution.

>
> Any solution? How can I insert a java.util.date obtained from a calendar
> object in a Oracle DB (java.sql.Date)?
>

Calendar stCal = Calendar.getInstance();
java.util.Date utlDate = stCal.getTime();
java.sql.Date sqlDate = new java.sql.Date(utlDate.getTime());
stmt.setDate(COLUMN_DATA, sqlDate);



I'll be honest : this solution isn't mine but it's written by Thomas Kellerer. I found it at http://www.dbforums.com/archive/index.php/t-1100948.html.

Reply With Quote
  #3  
Old July 28th, 2005, 01:20 AM
harshika harshika is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 24 harshika User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 1 m 33 sec
Reputation Power: 0
date and time ..java/ mysql / jsp

hi ,
what i did is wrote in top of jsp of addLend.jsp
<%@page import="java.util.*" %>
java.util.Date lenDate = new java.util.Date();


and wrote in bean class
private Date lendDate;
private Date returnDate;

and
i need to define the returnDate as 4 days plus the lendDate.
i dont know how to do it.

later i have to convert java.util.Date in to mysql date type. it's ok with me.

i'll try the method you mentioned

Reply With Quote
  #4  
Old July 29th, 2005, 02:57 AM
gertcuppens's Avatar
gertcuppens gertcuppens is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 118 gertcuppens User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 28 m
Reputation Power: 5
I'm afraid I can't give you any code I've written as example. And you will have to learn about the class Calendar as well. It's true that Java does not have an easy way to manipulate dates. Some of the methods of the class java.util.Date are deprecated and it is strongly recommended you should use the methods of Calendar instead. Which means you will have to work with this class.
I suggest you read the following article :
http://www.onjava.com/pub/a/onjava/2003/06/05/java_calendar.html

Reply With Quote
  #5  
Old July 29th, 2005, 12:56 PM
harshika harshika is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 24 harshika User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 h 1 m 33 sec
Reputation Power: 0
thanks a lot.
it's a good tutorial .

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJava Development > help please


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT