Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process DateTime in to database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Rajendra
DateTime in to database
2 Answer(s)      5 years and 6 months ago
Posted in : Development process



Advertisement
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


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
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
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
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::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
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
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
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  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
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  from java code i have to retrieve some data from a database, which is present in a different timezone. Scenario :- My database... in database timezone is 9PM 15APR2012. I want to retrieve something from database
Database
Database  I am working in jsf2.Fro a demo i created database in ms access.no wi want to retrive a record from database for a particular data.I need help as I am stuck
Database
Database  How to represent data from database in a tree?   Please visit the following link: Retrieve data from database in tree using Java Swing
DATABASE
DATABASE  How can i get combo box values from database?? or how can i get values in the drop down menu of the html which is similar to dat of combo box in java - from database
database
database  I wanted to know if it is possible to establish database connection on a remote pc with mysql using java swings from netbeans and then create a database on the remote pc.... Kindly help me
database
database  I wanted to know if it is possible to create a database in mysql by letting the user enter the name of the database in swing gui..im doing my project in netbeans...Thank You
database
database  hi i want to develop one patient database can any one provide me the guide
database
database  sir.. how we can uplaod the database in the data file(ms access)please send me a solution
database
database  how we ca upload the data in the database file(ms access
database
database  dateofbirth is not save into the database while i am enter from html browser.it shows as null.whats the reason
Database
Database  Can i get a code for database connectivity Myeclipse 3.3 to MySql manager 2005
DATABASE
DATABASE  I can't send different information from different form into a single table in my database
database
database  Im doing my project in java swings...netbeans I wanted java source code to establish connection to postgresql_8.1 using jdbc and create a user defined database and a table in that database and insert values Plz help me
database
database  In my project,i want the user to specify the name of the database he wants to create in mysql and then also the name of the table along with the column names he wants in that database....Im doing my project in netbeans
Advertisements
 

 

 

DMCA.com