• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

getting timestamp from mysql database to my jsp page

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ....
 
Ranch Hand
Posts: 344
Oracle Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic