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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
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: 15
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: 344

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: 18141
    
    8

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 ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

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.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
renu sogi
Greenhorn

Joined: Feb 06, 2012
Posts: 15
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.........



[Thumbnail for s.png]

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60059
    
  65

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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getting timestamp from mysql database to my jsp page
 
Similar Threads
Struts with Ajax
finding the closest time in database record
Hibernate Cache Problem?
Java date to MySQL date conversion
Check status of MySQL replication with JDBC