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



Home Answers Viewqa JSP-Servlet retrieved time from mysql database
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sujitha
retrieved time from mysql database
2 Answer(s)      2 years and 4 months ago
Posted in : JSP-Servlet


Hi. I have retrieved time from mysql database. its in th format hh:mm:ss. but i want to display only as hh:mm. wat to do?


Advertisement
View Answers

August 28, 2012 at 10:44 AM


Here is a jsp example that fetch the time from the database and display in different format.

<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>

<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
        Statement st=conn.createStatement();
        ResultSet rs=st.executeQuery("select * from patient");
        SimpleDateFormat sdf=new SimpleDateFormat("hh:mm");
        while(rs.next()){
        java.sql.Time dbSqlTime = rs.getTime("tob");
        java.util.Date date = new java.util.Date(dbSqlTime.getTime());
        out.println(sdf.format(date)+"<br>");
        %>


August 28, 2012 at 10:46 AM


Here is a jsp example that fetch the time from the database and display in different format.

<%@page import="java.sql.*"%>
<%@page import="java.util.*"%>
<%@page import="java.text.*"%>

<%
Class.forName("com.mysql.jdbc.Driver").newInstance();
        Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root" );
        Statement st=conn.createStatement();
        ResultSet rs=st.executeQuery("select * from patient");
        SimpleDateFormat sdf=new SimpleDateFormat("hh:mm");
        while(rs.next()){
        java.sql.Time dbSqlTime = rs.getTime("tob");
        java.util.Date date = new java.util.Date(dbSqlTime.getTime());
        out.println(sdf.format(date)+"<br>");
        %>


Related Tutorials/Questions & Answers:
Swing JTable which is retrieved from MySQL
Swing JTable which is retrieved from MySQL  How To Display both image and data into Swing JTable which is retrieved from MySQL database
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.
How to use next and previous button(or href) for database table that is retrieved from MySQL DB.  Initially,display 7or10 records on a jsp pageand when click on the NEXT button(or href link) then display next 7 records
Advertisements
How to use next and previous button(or href) for database table that is retrieved from MySQL DB using jsp,jstl,javascript
that is retrieved from MySQL DB using jsp,jstl,javascript  when click on the next button/link then it must display next 10 record from database and same for previous to display previous 10records. Database Query like this: Select * from table
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page should display username, emailid, telephone in addition to tthe tagline however... sql = "select billid, customerid, billdate, status from customerbills where
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to display data into textboxes which is retrieved from the database
how to display data into textboxes which is retrieved from the database  I would like to know how to display data into textboxes which is retrieved from database in jsf. could you please provide a small example of how to do
how to perform operation on data retrieved from database in jsp?
how to perform operation on data retrieved from database in jsp?  i... entered marks into the database from the jsp page and i can also retrieved data from... on data retrieved from database and the present to the user PLEASE HELP ME TO SOLVE
how to use String tokenizer on table that is retrieved from database using jsp servlet
how to use String tokenizer on table that is retrieved from database using jsp servlet  Query:Table---- mysql> select pid,medicinename,dose,day,qty from medicinedetails2 where pid=15
open pdf file in same jsp page and the pdf file should retrieved from database
open pdf file in same jsp page and the pdf file should retrieved from database  Hai all, I need code to open a pdf file in same jsp page(browser) while click on hyperlink And the file was located in database table. Can any
How To Display both image and data into Swing JTable which is retrieved from ms access database
How To Display both image and data into Swing JTable which is retrieved from ms access database  So far this is my code how can i display both image and data from database.. while (rs.next()) { Vector row = new Vector(columns
Mysql From Table
Mysql From Table       Mysql From Table is used to specify the table from which the records is retrieved. Understand with Example The Tutorial illustrate an exanple from 'Mysql From
Time limit for a question from database injsp
Time limit for a question from database injsp  Hellu sir i am... the question and users answer these i want to add a time limit for a question which is fetched from database after the time over i want to show the next
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql database using php.... below my code is that.. <html> <head>
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list... from the dropdown, related data will get displayed on the textboxes. Here we have
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir... that retrieve the integer values from the database and stored in the integer variables. In addition to it, we have added numbers that are retrieved from
Repairing mysql database from command line
Repairing mysql database from command line  Hi, Can anyone tell me the process for repairing mysql database from command line? Thanks
How to access (MySQL)database from J2ME?
How to access (MySQL)database from J2ME?  I am new to J2ME. I am using NetBeans. Can anyone help me? How to access (MySQL)database from J2ME? ( I search a lot I found that there is need to access database through servlet
MySql Databse query to fetch results from database
MySql Databse query to fetch results from database  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
problem in selecting second arraylist from mysql database
problem in selecting second arraylist from mysql database  Hi... in mysql database. In the below program , i have hard-coded that second list, but i want second list to be dynamic from database. Please, help me out. Thank
image is display from path of mysql database
image is display from path of mysql database  <%@ page import="java.io.,java.sql.,java.util.zip.*" %> <% String saveFile=""; String...;% Connection connection = null; String connectionURL = "jdbc:mysql://localhost
Mysql Time Zone Conversion
Mysql Time Zone Conversion       The Tutorial illustrate you an example from 'Mysql Time Zone... for converting a date time value  from one time zone to the other time zone. dt
Mysql Time Now
Mysql Time Now       Time Now is used to return you a current time in Mysql. Understand with Example The Tutorial help you to make an example from Time Now in Mysql. In this Tutorial
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  how to send data from mysql database to google chart api using java
Retrieve image from mysql database through jsp
Retrieve image from mysql database through jsp... to retrieve image from mysql database through jsp code. First create a database... will be retrieved from database on the basis of  'id' field of the table. So code
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current ... that return you the current date  from date time as Date field name
manipulating dat retrieved from the DB using php arrays
manipulating dat retrieved from the DB using php arrays  am querying the DB as follows: $`result=mysql_query("SELECT name,itemquantity FROM mytable... it.(this is a trading platform),so let's say a user wanted to buy 25 items from the data
manipulating dat retrieved from the DB using php arrays
manipulating dat retrieved from the DB using php arrays  am querying the DB as follows: $`result=mysql_query("SELECT name,itemquantity FROM mytable... it.(this is a trading platform),so let's say a user wanted to buy 25 items from the data
manipulating dat retrieved from the DB using php arrays
manipulating dat retrieved from the DB using php arrays  am querying the DB as follows: $`result=mysql_query("SELECT name,itemquantity FROM mytable... it.(this is a trading platform),so let's say a user wanted to buy 25 items from the data
 

 

 

DMCA.com