This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes SimpleDateFormat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "SimpleDateFormat" Watch "SimpleDateFormat" New topic
Author

SimpleDateFormat

Mike Hays
Greenhorn

Joined: May 15, 2009
Posts: 14
Hello again,

Does anyone know if its OK to use SimpleDateFormat in this project? The documentation for constructors in this class says "This constructor may not support all locales. For full coverage, use the factory methods in the DateFormat class." Is this not portable enough?
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5123
    
  12

Hi Mike,

I just handled the dates as Strings, so no conversions or formatting (because you don't need it to find and book rooms). But a SimpleDateFormat will do the job. Although if I'm not mistaken it generates a valid date, also when you have a String that doesn't exactly match the pattern. More info can be found here.

Kind regards,
Roel


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2258
    
    3

Howdy, Mike!

Roel De Nijs wrote:I just handled the dates as Strings, so no conversions or formatting (because you don't need it to find and book rooms).


Me too! And Mike, since you are not required to format them, my advice would be to keep things as simple as possible and not to format them.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: SimpleDateFormat
 
Similar Threads
how to get date in YYYYMMDD format
how to get system date and format it
Date type conversion from dd/mm/yyyy to yyyy-mm-dd
DateValidation
getting System time