• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convertDateTime seconds???

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have that, to convert my Date-Object into a Local-sensitive manner:



The output:



BUT I need the seconds, tooo!

When I print this out without converter:





But I need the converter and cannot use a pattern as when using a pattern, I guess, the Local-sensitivity does not work.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nimo frey wrote:But I need the converter and cannot use a pattern as when using a pattern, I guess, the Local-sensitivity does not work.

Guess? This makes no sense. Just use a pattern.
 
Piotr Swiecicki
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Have you tried dateStyle="full" instead?
http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried it with long, tried it with full:

<f:convertDateTime type="both" dateStyle="full"/>

but no seconds visible.

Using a pattern such as: <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>

works but then it will prints it to that string for ALL Locales !!

I do not understand why dateStyle="full" does not print the seconds.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
nimo frey wrote:Tried it with long, tried it with full:

<f:convertDateTime type="both" dateStyle="full"/>

but no seconds visible.

Using a pattern such as: <f:convertDateTime pattern="yyyy-MM-dd HH:mm:ss"/>

works but then it will prints it to that string for ALL Locales !!
Oh, you want a locale dependent format? OK then

I do not understand why dateStyle="full" does not print the seconds.

Maybe your locale doesn´t "allow" that. Also see the aforementioned javadoc of DateFormat. Here´s an extract of relevance:

... You can pass in different options to these factory methods to control the length of the result; from SHORT to MEDIUM to LONG to FULL. The exact result depends on the locale, but generally ...

So, either life with it or use a fixed pattern.
 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact result depends on the locale




aha. so my browser says me: "Hey, you are not allowed to see the seconds!"

aha..okay.

I use my pattern. thanks:-)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic