Solved

How to control the environmental format of SimpleDateFormat

Posted on 2004-10-18
3
210 Views
Last Modified: 2010-03-31
Hi,
I'm using SimpleDateFormat in this way wherever I 'go':
   /**
    *  Returns the <b>given</b> date formatted as <b>dd-MMM-yyyy</b> (day-month-year).
    *
    * @param d the date to be formatted.
    * @return the formatted result as a String.
    */
   public static String getDate(Date d)
   {
      return(new SimpleDateFormat("dd-MMM-yyyy").format(d));
   }
However, on certain machines this gives "19-Oct-2004" (what I prefer),
on other machines "19-okt-2004" or worse, due to international settings.
For various reasons I want to standardise on the 'English' format.
How do I force these things?
;JOOP!
0
Comment
Question by:sciuriware
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 12345115
try specifying the Locale in the SDF ctor.
0
 
LVL 24

Author Comment

by:sciuriware
ID: 12345171
The first, the correct, the shortest and the abbreviated answer, always from YOU!
Do you ever sleep?








:>)
0
 
LVL 92

Expert Comment

by:objects
ID: 12345197
:)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
check java version using powershell 13 170
tomcat startup error 5 102
ejb example issues 3 23
How do I remove an object from a 3 40
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question