system date format

hi all

I am having problem with java date format.

I want to display date according to current system date format.

I am using short date format but even after changing the short date format from system the changes doesn't reflect in java code.

here is the code

import java.text.*;

import java.util.*;

import java.io.*;

import java.awt.*;

import javax.swing.*;

public class time {

private PrintWriter pw;

public void formatDate(Locale l) {

Date date = new Date();

String[] formatedDate = {

"Language = "+l.getDisplayLanguage(),

"Country = "+l.getDisplayCountry(),"(date, DEFAULT) => "+ DateFormat.getDateInstance(DateFormat.DEFAULT, l).format(date),

"(date, SHORT) => "+ DateFormat.getDateInstance(DateFormat.SHORT, l).format(date),

"(date, MEDIUM) => "+ DateFormat.getDateInstance(DateFormat.MEDIUM, l).format(date),

"(time, SHORT) => "+ DateFormat.getTimeInstance(DateFormat.SHORT, l).format(date),

"(time, MEDIUM) => "+ DateFormat.getTimeInstance(DateFormat.MEDIUM, l).format(date),

"(time, LONG) => "+ DateFormat.getTimeInstance(DateFormat.LONG, l).format(date),

"(time, FULL) => "+ DateFormat.getTimeInstance(DateFormat.FULL, l).format(date),

"--"};

//HKEY_CURRENT_USER\Control Panel\International\sShortDate

for (int i = 0; i < formatedDate.length; i++)

System.out.println(formatedDate);

}

public static void main(String args[])

throws IOException {

time d = new time();

d.formatDate(new Locale("en", "AU"));

Locale l = new Locale ("en", "AU");

d.formatDate(l);

}

}

i need to show date format according to short but long is working .

plz help

[1808 byte] By [amitwaliaa] at [2007-10-2 0:36:16]
# 1

The Java platform does not monitor the system locale for changes during run-time. The JRE has its own date/time formats and does not retrieve them from the host system.

If you want to display dates using a format that isn't available, you need to use SimpleDateFormat to create a pattern of your own choosing.

It's quite old, but the information is still mostly accurate:

http://www.joconner.com/javai18n/articles/DateFormat.html

Regards,

John O'Conner

joconnera at 2007-7-15 16:51:01 > top of Java-index,Desktop,I18N...
# 2
problem is i don't want to customise date i wan to pick system date.Cos in my software user can change system date format only and the software has to update with system.Thats why i don't want to use simpledateformat.
amitwaliaa at 2007-7-15 16:51:01 > top of Java-index,Desktop,I18N...