• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Date Format  RSS feed

 
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
 
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
 
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!