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

