Returns: in the US MM/DD/YY, in the UK DD/MM/YY, in brazil..... blah blahI need it to return: in the US MM/DD/YYYY, in the UK DD/MM/YYYY, etc...

Thanks in advance,Lisa

Posts:24,036 Registered: 2/3/03

Re: date format question Aug 5, 2004 7:58 AM (reply 1 of 66)

[url=http://www.javaalmanac.com/egs/java.text/FormatDate.html]Formatting a Date Using a Custom Format[/url][url=http://www.javaalmanac.com/egs/java.text/ParseDate.html]Parsing a Date Using a Custom Format[/url]

Posts:357 Registered: 8/5/04

Re: date format question Aug 5, 2004 8:03 AM (reply 2 of 66)

could you please send me an email at xterminator890i@hotmail.com (yaw)

i would like to begin from there

Posts:24,036 Registered: 2/3/03

Re: date format question Aug 5, 2004 8:03 AM (reply 3 of 66)

Having re-read your OP, I think those links may not help...

Posts:24,036 Registered: 2/3/03

Re: date format question Aug 5, 2004 8:04 AM (reply 4 of 66)

could you please send me an email atxterminator890i@hotmail.com (yaw)

??

i would like to begin from there

What does me sending you an email have to do with "beginning from there"?

Posts:319 Registered: 11/8/00

Re: date format question Aug 5, 2004 8:07 AM (reply 5 of 66)

could you please send me an email atxterminator890i@hotmail.com (yaw)

??

i would like to begin from there

What does me sending you an email have to do with"beginning from there"?

sounds like you've pulled.

please don't ask for replys by email it stops others learning and also stops others reviewing code that is posted.

It works in my locale, but test it in others. By the way the API docs for DateFormat say the cast to SimpleDateFormat may not work in rare cases, so catch any ClassCastException on that line and skip the rest of the code in that case.

PC²

Posts:7,258 Registered: 1/31/02

Re: date format question Aug 5, 2004 8:16 AM (reply 8 of 66)

To the OP (who isn't the id that's asking for some sort of personal relationship with yawmark - which is both sweet and a little creepy) -

If the MEDIUM format doesn't work for you (where you get your 4 digit year, but lose the numeric month/date) then you'll likely have to do some sort of locale-specific formatting decisions with SimpleDateFormat, because I don't see a way to add your own styles to the DateFormat class (though I didn't look terribly hard)

No. There's nothing secret or proprietary about what yawmark or anybody else would discuss with you about formatting a date. And if there is, then you should enter into a legally binding contract, and will probably have to pay the person who's doing the work.

I'm not sure I understand you question, but if I do, you want to use the default format for a locale, BUT if that involves a 2-digit year you want to change it to a 4-digit year.

Don't ask people to reply by private email. Most Forum regulars believe solving problems should be a public, transparent process during which a first try at an answer can and should be corrected if someone more knowledgeable notices that it is incomplete or incorrect. Also, they get some of their reward for being respondents from being seen to be competent and knowledgeable by their peers (not to mention the possibility of collecting some of those precious [url=http://forum.java.sun.com/rewardFaq.jsp]Duke Dollars[/url]).