• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getting timestamp from mysql database to my jsp page

 
renu sogi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21117
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
renu sogi
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.........
s.png
[Thumbnail for s.png]
table view
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic