• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to diplay correct date & time ???

 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I want to display date & time, i specified like this,


but the output shows 11/07/2005 12:00 AM

it shows 12:00 AM, its wrong.

can anybody tell me how to display the exact time which is in database.

thanks in advance
Gopal
 
Gerardo Tasistro
Ranch Hand
Posts: 362
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you give an example on how you want it to show?
 
Paul Clapham
Sheriff
Posts: 21322
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure your database column is a timestamp (not date) column? If it were a date column then it wouldn't have a time component and you would see exactly what you are seeing.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

My database column data type is DATE, but in my database it shows values like 11/7/2005 10:12:45 PM
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gerardo,

I want to show like " 11/07/2005 10:12 AM. "
i specified the format in <f:convertDateTime> but it is not working.
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the value being obtained from the database? If you are using the JDBC, which java.sql.ResultSet method are you using: getDate or getTimestamp? You should be using the latter.
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Thanks for your replies. i got it.

Since i am using hibernate , simply i specified the type="timestamp" in xml mapping file.

in bean class the datatype is java.util.Date.

and i am getting the desired output with date & time in JSF(01/27/2006 3:17 PM) .

thank you all,

Gopal
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help us learn from your experience: what was your mistake?
 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my mistake is , in hibernate mapping xml file i was given type="date" instead of type="timestamp"

thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic