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



Home Answers Viewqa JSP-Servlet To store date

Have Programming Question? Ask it here!
 
 
 


Jagadeesh
To store date
1 Answer(s)      6 years ago
Posted in : JSP-Servlet



Advertisement
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 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
Advertisements
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
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
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
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
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 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
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
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
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
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
Unable to store the image into database
Unable to store the image into database  Hello, I have created below program and program is throwing FileNotFound exception when I pressed the submit button. The problem is coming due to JSP page is not able to find complete path
To store value in session & display it
To store value in session & display it  Hello..I m trying to run the following code which will store the session of a book selected on click of the button.But first it was showing NullPointerException and then blank page..Please
servlet program for data store in oracle?
servlet program for data store in oracle?  how to store data in oracle through servlet program
how to write store procedure in sql
how to write store procedure in sql  How to write a store procedure in SQL Server
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
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
how to store,retrieve,modify the data
how to store,retrieve,modify the data  hello sir ,how to store,retrieve,modify the data using the swing please help me
store form data into word document
store form data into word document  i want form page data, ex username phone number.. to store it in a word document file
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
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
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
store and retrive image from the database
store and retrive image from the database  please provide me with the code and the explanation of what each line does for the below query. -how to store and retreive images from sql database using sql commands -how to store
image store in oracle using jswing
image store in oracle using jswing  hello ,ihave searched the image store in oracle using jswing but i did not find the code please help me
date convertion
date convertion  How to convert the string date format 23/11/2009 to original date format in asp.net
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
store Error in a logfile - Java Beginners
store Error in a logfile  I am using java to get details form more... store in a particular file and error should mail error to particular mail id. I... error in a particular log file using java". please reply soon
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
Advertisements
 

 

 

DMCA.com