| Author |
How to Inserting current Date to DataBase
|
prasant sahoo
Greenhorn
Joined: Dec 14, 2007
Posts: 7
|
|
In my JSP I am sending the current date as follows <%java.text.DateFormat dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd"); String schduleDate = dateFormat.format(new java.util.Date()); %> <input type="text" name="scheduledDate" value="<%=dateFormat.format(new java.util.Date()) %>" readonly="true"/> But in the DataBase (SQL) it is inserting 1/1/1900. please help
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56157
|
|
The code you have shown is merely the code that displays the date in an input box. What does it look like on the screen? The way you expect? Without further details regarding how that date -- remember that when it submitted it will just be a String value -- is being inserted into the database, I'm not sure anyone is going to be able to help you. [ January 16, 2008: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Qussay Najjar
Ranch Hand
Joined: Jan 18, 2008
Posts: 53
|
|
What is the database you're using, If it was Oracle I have a way for you..
|
Qussay NAJJAR
|
 |
Paul Campbell
Ranch Hand
Joined: Oct 06, 2007
Posts: 338
|
|
DB2 current date Oracle sysdate mysql CURDATE()
|
 |
 |
|
|
subject: How to Inserting current Date to DataBase
|
|
|