?
Solved

How to control the environmental format of SimpleDateFormat

Posted on 2004-10-18
3
Medium Priority
?
215 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 1000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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