retrieved time from mysql database

retrieved time from mysql database

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?

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
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>
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
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
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
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
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
How to retrieve image from mysql database in JSP?
How to retrieve image from mysql database in JSP?  Hi, I need JSP same codes for learning to get image which is stored in MySQL Database. How to retrieve image from mysql database in JSP? Thanks   Hi, You can write
Mysql From Table
Mysql From Table       Mysql From Table is used to specify the table from which the records... from 'Mysql From Table'. To grasp this example we create  a table 'Stu
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
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... Note : In the jsp code given below, image will be retrieved from database
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
how to store JTree data hierarchically in mysql database from netbeans
how to store JTree data hierarchically in mysql database from netbeans  how to store JTree data hierarchically in mysql database from netbeans. I am new to this topics so I need a program and tables you are using in database
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field... record based on username and password. I dont know how to retrive in php with mysql
how to display image and text in single jsp page from the mysql database
how to display image and text in single jsp page from the mysql database  hello please help me to display the image and text in single jsp page from mysql database if have any reference code please send me Thanks in advance
simple code to login user & authenticate it from database mysql
simple code to login user & authenticate it from database mysql  Sir, I am creating a login page which contain userid & password. Iwant to authenticate user from mysql database. please tell me the code for it. Thanks
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
retrive the employee details with image from mysql database using jsp servlet
retrive the employee details with image from mysql database using jsp servlet  im doing the web project to retrive the employee profile which i stored in the database using jsp servlet then want to show the result in the next jsp
dynamic retrival of data from mysql database to dropdownlist in jsp
dynamic retrival of data from mysql database to dropdownlist in jsp  ... name from the mysql database to the dropdownlist.if the user select the particular... be retrieved from the database and display in the textboxes. 1)selectname.jsp
Data needs to be gathered in XML file from the database (MySql) using JSP
Data needs to be gathered in XML file from the database (MySql) using JSP ... data regarding particular id from the database table. Data needs to be gathered in XML file from the database (MySql) using appropriate JSP/Java Bean functions
dynamic retrivel of data from mysql database in table format at jsp
dynamic retrivel of data from mysql database in table format at jsp  ... the data from database and display it as table format in jsp... For example, i have... of A1 should be retrived from database and display it in the respective textbox
MySql Databse query to fetch results from database and display it in HTML File
MySql Databse query to fetch results from database and display it in HTML File  Hi. I have a field in database named stages. its datatype is varchar... to retrieve these data from the field table. Actually they are separated by comma
Mysql Date from Date
Mysql Date from Date       Mysql  Date from Date Time in Mysql return the Current ... an example from 'DateTime in Mysql'. To grasp this example, we use date(current
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  ..._db("samp", $con); $Name=$_POST['unames']; $data=mysql_query("SELECT * FROM tbl... like this.. <?php $con = mysql_connect("localhost","root
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  Äîáîâëÿéòåñü â ãðóïïó "ÌÀÉÍÊÐÀÔÒÀ" Áóäüòå ó÷àñòíèêàìè Ãðóïïû Ïîìîãàèòå íàì è ñåáå Íàøà ãðóïïà https://vk.com/club60851464 Åñòü ñâîé ñåðâåð! Õîðîøàÿ àòìîñôåðà
Video Tutorial: How to access MySQL database from JSP?
How to access MySQL database from JSP? In this tutorial,I will teach you how to access data from JSP page. We are using MySQL database and we have a table... to access MySQL database from JSP?": So, we have pasted it here
JDBC Video tutorial - How to read Data from MySQL Database?
JDBC Beginners tutorial for reading the data from MySQL database - RoseIndia.Net In this tutorial you will learn the code to read the data from the MySQL..._TO_REPLACE_1 Steps for reading the data from MySQL database in a Java program
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello... are strored in table called appreciation in a mysql database. i followed sevrel..._query("SELECT * FROM appreciation"); while ($row = mysql_fetch_array
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello... are strored in table called appreciation in a mysql database. i followed sevrel..._query("SELECT * FROM appreciation"); while ($row = mysql_fetch_array
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello... are strored in table called appreciation in a mysql database. i followed sevrel..._query("SELECT * FROM appreciation"); while ($row = mysql_fetch_array
adding multiples markers to google map from a mysql database
adding multiples markers to google map from a mysql database   hello... are strored in table called appreciation in a mysql database. i followed sevrel...()); ?> <? $query = mysql_query("SELECT * FROM
Mysql Time Now
Mysql Time Now       Time Now is used to return you a current time in Mysql. Understand with ExampleADS_TO_REPLACE_1 The Tutorial help you to make an example from Time Now in Mysql
Mysql Time Zone Conversion
Mysql Time Zone Conversion       The Tutorial illustrate you an example from 'Mysql Time Zone... that is used for converting a date time value  from one time zone to the other
Retrieve date from MYSQL database
Retrieve date from MYSQL database In this tutorial, you will learn how to retrieve date from database. Storing and Retrieving dates from the database is a common task. MYSQL provides different ways of inserting and fetching dates from
MYSQL Database
MYSQL Database  Can any one brief me about how to use MYSQL Database to store the create new database, create tables. Thanks.   Hi, the MySQL database server is most popular database server and if you want to know
how to upload an image from a jsp page to a mysql database table using jsp
how to upload an image from a jsp page to a mysql database table using jsp  how to upload an image from a jsp page to a mysql database table using jspstrong text

Ads