File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes getting timestamp from mysql database to my jsp page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "getting timestamp from mysql database to my jsp page" Watch "getting timestamp from mysql database to my jsp page" New topic
Author

getting timestamp from mysql database to my jsp page

renu sogi
Greenhorn

Joined: Feb 06, 2012
Posts: 12
hello ! everyone ...
I am developing a banking project using jsp servlet and mysql as my database ...... I have created a small table having column 'timestamp' which stores a time when a any transaction takes place ... now i want that respective transaction time on my jsp page .... but just cant get it if you guys have any idea please help .........
Thanks in advance ....
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 339

How are you currently selecting from this table? You could get the timestamp as a java.sql.Timestamp instance and then cast it to a string, which are several ways of doing this.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 13842

Koen, you're assuming the question is about how to get the data from the database. There isn't anything in the original post which suggests that is the problem.

In fact there isn't anything in the original post which says anything about the problem. "renu", could you post a question which describes your problem in some detail? Read our FAQ entry TellTheDetails (click that link) for a more complete explanation.
Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

Koen Aerts wrote: and then cast it to a string

Bad idea.

Leave it as a Date and use the <fmt:formatDate> JSTL action on the page to display it in the desired pattern.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
renu sogi
Greenhorn

Joined: Feb 06, 2012
Posts: 12
Well ! thank every one for the reply .... As you might not understood the problem correctly........ Let me describe it in little more deep........... I have a table in mysql (image is provided..) here you can the field 'time' of type 'timestamp'. Now I want this timestamp on my jsp page which show the user that the last transaction from your account had occured at this particular time and date; for which I need that respective time stamp on my jsp page ........ and thats where i got stuck... I am just unable to get that on my jsp page.........
[Thumb - s.png]
 Filename s.png [Disk] Download
 Description table view
 Filesize 8 Kbytes
 Downloaded:  3 time(s)

Bear Bibeault
Author and opinionated walrus
Marshal

Joined: Jan 10, 2002
Posts: 50693

Just saying "I can't do it" doesn't help us help you.

What part can't you do? Can you not get the value from the table? Can you not create a scoped variable from that value? Can you not put the <fmt:formatDate> tag on the JSP?
 
 
subject: getting timestamp from mysql database to my jsp page
 
Threads others viewed
Hibernate Cache Problem?
Java date to MySQL date conversion
Struts with Ajax
Check status of MySQL replication with JDBC
finding the closest time in database record
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture