Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  

To store date



Share on Google+Share on Google+

To store date
1 Answer(s)      8 years ago
Posted in : JSP-Servlet
View Answers

September 27, 2008 at 11:56 AM

Hi friend,

Code to store date in database :

<%@ page import="java.sql.*,java.util.*,java.text.*,java.text.SimpleDateFormat" %>
Connection con=null;
PreparedStatement pstatement = null;
String url = "jdbc:mysql://localhost:3306/";;
String dbName = "file_upload";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "root";

con = DriverManager.getConnection(url+dbName,userName,password);
java.util.Date now = new java.util.Date();
String DATE_FORMAT = "yyyy-MM-dd";
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);

String strDateNew = sdf.format(now) ;

String queryString = "INSERT INTO file_tbl set file_date='"+strDateNew+"'";



val = pstatement.executeUpdate();

<b><%=strDateNew%> Inserted into Database .</b>

catch(Exception e)

For read more in details :



Related Tutorials/Questions & Answers:
To store date - JSP-Servlet
the method. And send the actual query to store the date also. With lots of thankzs.....   Hi friend, Code to store date in database...To store date  Hai friends, I want the format to store
How to Store Date - Java Beginners
How to Store Date  How to Validate date in JTextField ,How I can Store it in Aceess Databse, and I want to set Last Date of Admission,if Last date of admission is equal to current date then i want display Today is Last date
Jsp Code to store date in database - JSP-Servlet
Jsp Code to store date in database   Hi, Can u give me jsp code to store current date in to database. Thanks Prakash
store current system date in to database - Development process
store current system date in to database  Hi,this is my code . here iwant to store current system date in to database and want to store subdept..."].elements["combo2"].options.length=0; for (var i=0;i<% java.util.Date date
store  i want to store data in (.dat) file format using swing and perform operation on that insertion,deletion and update
store  hi i want store some information in my program and use them in other method. what shoud i do
date   how to insert date in database? i need coding
date  how to store in database (oracle 10 g) using JDBC and servlets... 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
date  can u tell me how to calculate difference between a user provided date and the system date in java
date  can u tell me how to calculate difference between a user provided date and the system date in java
date  i want difference between the date entered in a jtextfield and the system date in java
date  how to insert date using html through the combobox
date  how to insert date using html through the combobox
date  how to insert date using html through the combobox
date  how to insert date using html through the combobox
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
Batchwise Store
Batchwise Store  i want to read the column from excel and store the data as batchwise into database
date format - Date Calendar
date format  how to convert dd-mmm-yyyy date format to gregorian... to convert date to calender. import java.util.*; import java.text.*; public...="19-Sep-2008"; DateFormat format ; Date date ; format = new
Date format - Date Calendar
Date format  please convert dd-mmm-yy date format to gregorian calendar date format.  Hi friend, Code related your Problem: import...]); Calendar calendar = new GregorianCalendar(pdt); Date time = new Date
date - Date Calendar
date   hi, sir i am doing student details project in swing but i am not getting current date in jtextfield in date it is giving ambigious error... label=new JLabel("Current Date: "); JTextField text=new JTextField(15
Date Formay - Date Calendar
Date Formay  Sir, How to comapare two different date format in java.  Hi friend, Code to compare two different date import...)) System.out.print("Current date(" + new SimpleDateFormat("dd/MM/yyyy"). format
Java Xml Data Store
phone number, nature and date of the enquiry, and the name of the salesperson... enquiries sorted by date (ascending or descending) depending if they have be followed up and/or purchased. You will need to store the data in a local binary
convert current date into date format
convert current date into date format  How to get current date and convert into date format in Java or PHP
Date limit on Dojo Date picker - Date Calendar
Date limit on Dojo Date picker  Hi all, I am using dojo for date picker in my project. When user click on date text box, date picker will pop up. Using that component user can select date. Now I trying something different. I
Date format - Date Calendar
Date format  Hi All, I am getting a date from database as a format 2010-15-07.I need to change it to 07/15/2010 and display it on my date field.Every time i need to check the format of the date field and make sure the correct
Version of excalibur-store>excalibur-store dependency
List of Version of excalibur-store>excalibur-store dependency
date convertion
date convertion  How to convert the string date format 23/11/2009 to original date format in
Inser date in database - Development process
Inser date in database  Hi, In the follwing code i want to store system date in to database.First column as date field and Service_No ,UserName,CabinetSerialNo, ......... Thanks Prakash insert.jsp
About Store Procedure
About Store Procedure  Create Procedure CMTSPCasesByWorkstream...((Cast(dateadd(day,-7,cast(getdate() as Date)) as varchar) + ' 23:59:59') as Datetime) -- 'yyyy-mm-dd hh:mm:ss' Declare @startdate datetime = @paramstart_date
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current  date. Understand with Example The Tutorial illustrate an example from 'DateTime
Date Picker
Date Picker  "I want to set default calendar date when using datepicker. This date means auto-loaded date when the calendar appears. The default date is the current date. I want to change it. How could I do