Online Hibernate Training just in Rs. 1000

One week online training in Hibernate ORM framework. Learn Hibernate Framework and enhance your skills. Best Online Hibernate training at 90% discount. Join Now!! Offer is valid Only for limited Period!!! Online Training Big Data and Hadoop Training Java Training  
 

DateTime in to database

Ads

 
 

Share on Google+Share on Google+

Rajendra
DateTime in to database
2 Answer(s)      8 years ago
Posted in : Development process
Ads
View Answers

June 26, 2009 at 11:35 AM


Hi Friend,

To insert the date,use the following code in your application:

java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
<%
----------------
-------------------
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:odbc:access");
Statement statement = connection.createStatement();
String DateOut="29/06/2009";

String sql = ("INSERT INTO View_Service VALUES ('"+ ServiceNo + "','" + dt + "','" + Dateout + "','" + UserName + "','" + CabinetSerialNo + "','" + Department + "','" + Sub_Dept + "','"+ Issue +"','"+ Remark +"','"+ SlNo_ForNew +"','"+ Problem_Code +"','" + Problem_Solved + "')");
statement.executeUpdate(sql);
out.println("Data is inserted into the database");
statement.close();
connection.close();
*>

Thanks


June 26, 2009 at 11:36 AM


Hi Friend,

To insert the date,use the following code in your application:


<%
java.sql.Date sqlDate = new java.sql.Date(new java.util.Date().getTime());
----------------
-------------------
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:odbc:access");
Statement statement = connection.createStatement();
String DateOut="29/06/2009";

String sql = ("INSERT INTO View_Service VALUES ('"+ ServiceNo + "','" + dt + "','" + Dateout + "','" + UserName + "','" + CabinetSerialNo + "','" + Department + "','" + Sub_Dept + "','"+ Issue +"','"+ Remark +"','"+ SlNo_ForNew +"','"+ Problem_Code +"','" + Problem_Solved + "')");
statement.executeUpdate(sql);
out.println("Data is inserted into the database");
statement.close();
connection.close();
%>

Thanks

Ads









Related Tutorials/Questions & Answers:
DateTime in to database - Development process
DateTime in to database  Hi, can u give me jsp code for inserting Date and Time in ti database. Not seperately. Thanks Prakash... + "')"); statement.executeUpdate(sql); out.println("Data is inserted into the database
comparision between database's datetime field and systemdate of java application - Java Beginners
comparision between database's datetime field and systemdate of java application  Hi All, I have a database table which contains datetime... finding the date difference between database's datetime field and systemdate
Advertisements
Version of taglibs>datetime dependency
List of Version of taglibs>datetime dependency
datetime picker in struts2
datetime picker in struts2  i used datetimepicker and i created getters and setters with retutn type string when im reading date value which i entered through getter im getter date as well as time i want date only how can i get
struts2 datetime picker
struts2 datetime picker  i created a field with sx:datetimepicker with the name fromdate. and i wrote getters and setters for fromdate with datatype string. when im reading data im getting date+time but i want only date can u
Version of taglibs>datetime-doc dependency
List of Version of taglibs>datetime-doc dependency
Version of taglibs>datetime-examples dependency
List of Version of taglibs>datetime-examples dependency
Version of com.cogpp>datetime-generator_2.11 dependency
List of Version of com.cogpp>datetime-generator_2.11 dependency
DateTime::getOffset
DateTime::getOffset  in PHP This DateTime::getOffset functions returns... int DateTime::getOffset ( void ) int date_offset_get ( DateTime $object...: A DateTime object returned by date_create() Example: of PHP Date Time
SQL Between Datetime
SQL Between Datetime       The Tutorial illustrate an example from SQL Between Date time..._Table (Stu_Id varchar(2), Stu_Name varchar(15), Stu_Dob datetime); Insert Data
datetime picker is not opening
datetime picker is not opening  Hi I have a java servlet code in this date time picker is not opening. The same opens in JSP code. My code... WindowTitle ="DateTime Picker";//Date Time Picker title. var WeekChar=2;//number
Maven Dependency datetime >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of taglibs >> datetime version1.0.1 in your project
Maven Dependency datetime-doc >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of taglibs >> datetime-doc version1.0.1 in your project
Maven Dependency datetime-examples >> 1.0.1
You should include the dependency code given in this page to add Maven Dependency of taglibs >> datetime-examples version1.0.1 in your project
Maven Dependency datetime-generator_2.11 >> 0.1
You should include the dependency code given in this page to add Maven Dependency of com.cogpp >> datetime-generator_2.11 version0.1 in your project
Maven Dependency datetime-generator_2.11 >> 0.1-SNAPASHOT
You should include the dependency code given in this page to add Maven Dependency of com.cogpp >> datetime-generator_2.11 version0.1-SNAPASHOT in your project
Version of com.helger>ph-datetime-parent-pom dependency
List of Version of com.helger>ph-datetime-parent-pom dependency
database
database  database
database
database  database application
database
database  the code for initializing the database connection
database
database  i want to let the user select the name of database and then delete that database.......im doing project in swings netbeans
Maven Dependency ph-datetime-parent-pom >> 4.2.0
You should include the dependency code given in this page to add Maven Dependency of com.helger >> ph-datetime-parent-pom version4.2.0 in your project
Maven Dependency ph-datetime-parent-pom >> 4.2.1
You should include the dependency code given in this page to add Maven Dependency of com.helger >> ph-datetime-parent-pom version4.2.1 in your project
Maven Dependency ph-datetime-parent-pom >> 5.0.0
You should include the dependency code given in this page to add Maven Dependency of com.helger >> ph-datetime-parent-pom version5.0.0 in your project
Maven Dependency ph-datetime-parent-pom >> 5.0.1
You should include the dependency code given in this page to add Maven Dependency of com.helger >> ph-datetime-parent-pom version5.0.1 in your project
database
database  use of hyperlink to show the data from database
database
database  i need to insert time in my database. i need a code to insert time in my database. its very urgent
database
database  im doing my project in netbeans swings...wn a user wants to create a database from the gui...i want to display an error msg if a database with that name already exists and if it does not exist new database should
database
database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover... links: Connect JSP with database Mysql Connect Java with database Mysql
database
database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover... links: Connect JSP with database Mysql Connect Java with database Mysql
database
database  tell me use about database and give me a small program.   It is secure and can easily be accessed, managed, and updated. Moreover... links: Connect JSP with database Mysql Connect Java with database Mysql