Home Answers Viewqa JSP-Servlet To store date

 
 


Jagadeesh
To store date
1 Answer(s)      4 years and 8 months 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" %>
<html>
<%
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";
try{

Class.forName("com.mysql.jdbc.Driver");
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+"'";

//out.println(queryString);

pstatement=con.prepareStatement(queryString);


val = pstatement.executeUpdate();

if(val>0)
{
%>
<br><br>
<b><%=strDateNew%> Inserted into Database .</b>
<%
}


}
catch(Exception e)
{}
}
%>
</html>

For read more in details :
http://www.roseindia.net/jsp/fileupload.shtml

Thanks









Related Pages:
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
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
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
store
store  i want to store data in (.dat) file format using swing and perform operation on that insertion,deletion and update
store
store  hi i want store some information in my program and use them in other method. what shoud i do
project in JSP and XML(to store data)
project in JSP and XML(to store data)  I need to complete an assignment in JSP and using XML as Database ,Please help me to complete...) Task_name Taske_status Project Comments Creation Date
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
SQl Date
; Date : The format used to store the Date is YYYY-MM-DD  Once your table... SQL Date       The SQL Date is used when you are working with dates. This include
online book store by using MVC architecture
online book store by using MVC architecture  Tarzan book store decided to go online to increase itsā?? revenues and provide itsā?? customers a way... to have an option to see his previously ordered books with buy date. Before
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
Date & TIme - Development process
Date & TIme  Hi, I asked to insert Date and Time to database with am pm. but u send only date. Already date is stored. but i want to store date with time. Hi Friend, To insert the date,use the following code in your
date
date   how to insert date in database? i need coding
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
Date - Swing AWT
date,year,month should not be less than current. 2.i want to store these date...Date   sir i have one JSpinner and a textfield that will display the current month and year next to that there is another a Textfield for Date
java date - Java Beginners
is "login" the name,date,time is automaticaaly inserted into the database . My doubt is iam storeing system date and system time but i want to store i server time and server date. pls help me
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
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
Batchwise Store
Batchwise Store  i want to read the column from excel and store the data as batchwise into database
Convert String to Date
with this date format. We are creating an object of Date to store the parsed... Convert String to Date       In this example we are going to convert string into date We
Convert String to Date
with the date format. We are creating an object of Date to store the parsed formatted... Convert String to Date       In this example we are going to convert String into date. In java date
Addintion in year fields of sql date in a java page
and generate the date after 4 years of Starting Date and store it into the database...Addintion in year fields of sql date in a java page  In my database i have a field StartDate and EndDate Now entering date from my jsp
SQL Date
as:   Date : The format used to store the Date is YYYY-MM-DD ... SQL Date         The SQL Date is used when you are working with dates. This include
Creating a MySQL Database Table to store Java Types
Creating a MySQL Database Table to store Java Types... to store a java types in our database table. Now one question may arise in your... are providing you an example with code for creating a table to store java types. Brief
Insert current date into MYSQL database
to store dates in the database system like DATE, TIMESTAMP, DATETIME and YEAR.... If you will enter a date in another format, it wouldn't store the date you...Insert current date into MYSQL database In this tutorial, you will learn how
Get Tomorrow Date
the get time () method that return you the current time and store in a variable date... Method to return a current time and store in  a date variable. The format... Get Tomorrow Date      
Flex DateChooser with Date Class
DateChooser with Date Class:- In this tutorial you can see how to use DateChooser with the help of Date Class in flex and how to use it. DateChooser control use selectedDate property  to store currently selected date as object
Code to insert date in to database - Development process
Code to insert date in to database  Hi , in my following code i want to store date in to msaccess database. i have tried many queries, but am getting error . plz send me code Error 500--Internal Server Error
PLEASE Help me write a Java program which will store, manipulate, and print student registration information.
PLEASE Help me write a Java program which will store, manipulate, and print... will store, manipulate, and print student registration information. As part..., and Date, where: (a) Name is a user defined class comprising of at minimum first
Online Shopping Store Website Templates
Did you planning for create you own Online Shopping Store Websites? Are you planning for create you own Online Shopping Store Websites? Rose India Technology, a Delhi based Web Designing Company offers awesome Online Shopping Store Web
Store ResultSt Data in a Map
Store ResultSt Data in a Map  i want to store data in a hash Map .Please solve my problem as soon as possible
How to store image into database
How to store image into database  Hi, all I want to store image into database using Java. Can anyone help me that how can i store image into database using Java. Thanks in advance.   hi friend, To store image
How to store an image in database
How to store an image in database  Hi........... How to store an image in postgresql using a query. I mean tell me the way to store an image using datatype. I am using the datatype bytea but tell me how to insert the image
Java Date Conversion
then parse the string with the date format. We are creating an object of Date to store... Java Date Conversion In java date conversion, two packages are used... of date in year, month, day, hour, minute, and second values. It also allows
iPad App to store data
iPad App to store data  Hi, How to add data support iPad application? Thanks
image store and get it back
image store and get it back  store the image in the oracle using blob... store the image in table but at time of reading it back it never shows me the image and how to convert the image file into binary format.... so that i can store
Store Variable in Java
Store Variable in Java  How to store Variables in Java?   public class DoubleTest { public static void main(String[] args) { double aDouble = 5.76; // Declare and initialize aDouble System.out.println
image store in database - JDBC
image store in database  Dear Deepak Sir, If I want to store image into the database what is the process to do that? Please explain... to store image into database. Check at http://www.roseindia.net/servlets/insert
dbase store - JSP-Servlet
dbase store  HI! In my project i have to store phone number in dbase. i used numeric (11,0) as data type for phone number. When i am trying to store the phone number, It is show showing error for Input String "given phone number
store and retrieve data
store and retrieve data  sir,i want to store the entering data in a word file and retrieve it when i need.i am try to develop a video portal.in which user can watch video and write comments.the comments are stored in a file
Android mobile store
Android mobile store  Hi, How to create Android mobile store application? Is there any free code that can be used for creating the applications? I want to distribute my application from my website. I don't what to distribute
How to store url path?
How to store url path?  Image is stored in physical directory like this String file = "C:/xampp/htdocs/jobqueen/" + username + createTimeStampStr() + ".PNG"; this physical directory is working fine but I want store in url

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.