• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 193
  • Last Modified:

date format

I need to get the default system date format, e.g. dd/mm/yy or m/d/yy from an applet.  Any good solution?
0
faster
Asked:
faster
1 Solution
 
setiawanCommented:
Using SimpleDateFormat

SimpleDateFormat df = new SimpleDateFormat ("dd/mm/yy");
java.util.Date now = new Date();
now = df.parse(now.toString());

 danny
0
 
fasterAuthor Commented:
I don't understand your answer.  What I need is to get the format, not to specify a format.
0
 
setiawanCommented:
sorry, I think I have wrong perception
please, reject my answer
Thanks
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
prabhuramCommented:
Date date=new Date();
System.out.println(date.getDate()+"/"+date.getMonth()+"/"+date.getYear());

the getDate(),getMonth() and getYear() are the methods in the Date class under java.util.Date Package
0
 
fasterAuthor Commented:
you don't understand my question.  I want to get the date format string. e.g. "dd/mm/yy" itself, not the specific date
0
 
SMTWCommented:
hi faster
from your statement
"I want to get the date format string"
I interpreteded that you want string telling what pattern is used for date
so you can do following
SimpleDateFormat  sf = new SimpleDateFormat();
//This will just create  
//SimpleDateFormat object having
//default system date format.  Then you
//can use following methods to get date
//format string              
sf.toPattern ());
sf.toLocalizedPattern ());
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now