wood burning stoves*
The moose likes Spring and the fly likes Is this the best way to format dates in Spring? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Is this the best way to format dates in Spring?" Watch "Is this the best way to format dates in Spring?" New topic
Author

Is this the best way to format dates in Spring?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using Spring 3.0. I wanted to take advantage of Spring forms, so I had



where endDate is a java.util.Datefield of my command object. However, I notice that the date is printed out in verbose format, and I would prefer to apply a formatting to it. The only way I have found so far is to abandon Spring forms and go with



I don't like this mixed Spring form/non-Spring form approach and so I wanted to ask if there's something I'm missing or if this is the only way to do it.

Thanks, - Dave
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Instead, you can take advantage of Spring 3 Field Formatting.


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61426
    
  67

Personally, I would never use a proprietary tag when a standard one is available. I have no problem with a "mixed approach" that involves the JSTL.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is this the best way to format dates in Spring?