• Post Reply Bookmark Topic Watch Topic
  • New Topic

Date Format  RSS feed

 
Chennarao Marvatu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai Friends
Is there any way to find out the Format by looking
out the Date ..That is say 08/11/2004 from this how can
we find this it is in the the format mm/dd/yyyy or dd/mm/yyyy or
some thing else


thanks
chennarao
 
Julian Kennedy
Ranch Hand
Posts: 823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chennarao,

If you just have the String '08/11/2004' then I assume you know there's no way you can know if that's supposed to be the 8th of November or the 11th of August.

I don't know of a way, using the Java 2 Platform, to find out what the various default date formats are for the default locale. If you simply want to determine the default on a given machine you could try something like:

It makes certain assumptions (e.g. what DateFormat.SHORT produces). You'll obviously need to change it for use as a method (not as straightforward as it looks!). It might also be worth checking out java.text.DateFormatSymbols though I'm pretty sure that doesn't do what you want.

HTH

Jules
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps the delimiter has something to say.
In Germany, you format a date "dd.mm.yyyy", not "dd/mm/yyyy" for instance.
But I'm not sure for other locales.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!