Solved

How to control the environmental format of SimpleDateFormat

Posted on 2004-10-18
3
206 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

758 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now