aspose file tools*
The moose likes JSF and the fly likes how to diplay correct date & time ??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to diplay correct date & time ???" Watch "how to diplay correct date & time ???" New topic
Author

how to diplay correct date & time ???

gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
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

Joined: Feb 08, 2005
Posts: 362
Can you give an example on how you want it to show?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

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

Joined: Feb 23, 2005
Posts: 99
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

Joined: Feb 23, 2005
Posts: 99
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

Joined: Sep 16, 2005
Posts: 1780
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.


There is no emoticon for what I am feeling!
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
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

Joined: Sep 16, 2005
Posts: 1780
Help us learn from your experience: what was your mistake?
gopal kishan
Ranch Hand

Joined: Feb 23, 2005
Posts: 99
my mistake is , in hibernate mapping xml file i was given type="date" instead of type="timestamp"

thanks
 
jQuery in Action, 2nd edition
 
subject: how to diplay correct date & time ???