Error in Storing date

Error in Storing date

View Answers

June 1, 2009 at 2:36 PM

Hi Friend,

MS Access Database sets the date in DD/MM/YYYY format. Take field id of text type and date of date/time type.Then try the following code:

<%@page import=" java.sql.*, java.util.*"%>
<%
try{
Connection conn=null;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver") ;
conn = DriverManager.getConnection("jdbc:odbc:access");

Statement pstmt = conn.createStatement();
java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
String INSERT_RECORD = "insert into insertDate(id,myDate) values('5', '"+sqlDate+"')";
pstmt.executeUpdate(INSERT_RECORD);
pstmt.close();
conn.close();
}
catch(Exception e)
{
e.printStackTrace();
}
%>
Thanks









Related Tutorials/Questions & Answers:
Error in Storing date - Development process
Error in Storing date  Hi, U have given this code for storing date..., MS Access Database sets the date in DD/MM/YYYY format. Take field id of text type and date of date/time type.Then try the following code: Thanks
storing date from html form to oracle 10g using servlet
storing date from html form to oracle 10g using servlet  i have following html form from where date,month and year is retrieved separately.. <... this date month year from html form into oracle 10g database where i have
Advertisements
storing date from html form to oracle 10g using servlet
storing date from html form to oracle 10g using servlet  i have following html form from where date,month and year is retrieved separately.. <... this date month year from html form into oracle 10g database where i have
JSF Date picker error - Java Server Faces Questions
JSF Date picker error  hi friend thanks for your... is the error on my code.here i have placed my code. Please kindly send me if there any mistakes happened.and i saw one error in my tomcat console. That error
sorting and storing data
sorting and storing data   sorting and storing data in UITableView
storing csv into oracle database
storing csv into oracle database  i want jsp code for storing csv file into oracle database
Storing array in php
Storing array in php  How to store an array in PHP
date
date   how to insert date in database? i need coding
iphone storing and fetching data
iphone storing and fetching data  How to store and fetch data in an iphone application
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  i want difference between the date entered in a jtextfield and the system date in java
Uploading a Software and storing in the database
Uploading a Software and storing in the database  I want to upload a software(may be of maximum 20mb) through JSP, and store it in the database. The coding present in the site for uploading and storing in the database
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
Remote file storing in mobile
Remote file storing in mobile  Hai.. i want to do my semester project..i have selected a topic "Remote file storing in mobile"..it is in the form like any Java enabled GPRS based mobile phone users can store their images,video
Remote file storing in mobile
Remote file storing in mobile  Hai.. i want to do my semester project..i have selected a topic "Remote file storing in mobile"..it is in the form like any Java enabled GPRS based mobile phone users can store their images,video
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
error
error  while iam compiling iam getting expected error
storing xml into database - XML
storing xml into database   hi i have an xml file it contains elements with attributes as well as nested elements so how to go forward .......with it i know how to persist a simple xml file into data base but i m finding some
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
storing data into flat files
storing data into flat files  how can i retrive data from database and store data in flat files   Hi Friend, Try the following code:ADS_TO_REPLACE_1 import java.io.*; import java.sql.*; import java.util.*; class
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
storing data in xml - XML
storing data in xml  Can u plz help me how to store data in xml using java  Hi Friend, Try the following code: import java.io.*; import java.util.*; import org.w3c.dom.*; import javax.xml.parsers.*; import
Storing and Reading data
Storing and Reading data   Hello, I'm developing a GUI application as part of an assignment but stuck on how my program stores and reads the data the user entered into the GUI table I created. I also wanted to apply a java code
Reading Text file and storing in map
Reading Text file and storing in map  Hi I have multiple text files. I want to read thoses files and store those records in map. Map will be of "LinkedHashMap<String, Map<String, String>>" type. Please let me know
Why string is storing null value - IoC
Why string is storing null value  I am reading lines from a file...! then it is storing it in a temp variable.... but when i am running the program it is also storing null value in temp. WHY so
to fetch data from ms word and storing into database
to fetch data from ms word and storing into database  i want to know how to fetch datafields from ms word and storing into database??? please answer soon .its urgent
jsp code for storing login and logout time to an account
jsp code for storing login and logout time to an account  I need simple jsp code for extracting and storing login and logout time in a database table..plz someone help me...   Please visit the following link: http
extracting phone number n storing in excel
extracting phone number n storing in excel  i need a program to open a doc file n extract phone numbers from it and store it in a excel sheet?? plz do reply and help me out with the problem
extracting phone number n storing in excel
extracting phone number n storing in excel  i need a program to open a doc file n extract phone numbers from it and store it in a excel sheet?? plz do reply and help me out with the problem
Storing the Color Image pixel values into 2d array
Storing the Color Image pixel values into 2d array  i want to store the color image pixel values into 2d array and agiain the array have to store into a text file using java... plz provide the code

Ads