how to write a date to a string

I'm trying to read/write a date to a string via the following method:

      private static DateFormat gmtFormat;                   
      static {
            gmtFormat = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
            gmtFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
      }

and then later

writeChildElement(elt, "TimeStamp", gmtFormat.format(timeStamp));
mde.setTimeStamp(gmtFormat.parse(selectedElt.getText()));

But, it looks like the lower order numbers or removed from the value when I watch the Date object in the debugger.  Is there a string representation that is human readable that i can use?
LVL 5
jjacksnAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

x4uCommented:
DateFormat.getDateInstance() does not format the time part of the date, you need to use DateFormat.getDateTimeInstance().

gmtFormat = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL, Locale.US);
Mick BarryJava DeveloperCommented:
You can use SimpleDateFormat to format it in whatever formnat you want

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Mick BarryJava DeveloperCommented:
> mde.setTimeStamp(gmtFormat.parse(selectedElt.getText()));

Why aren't you just using the original Date object instead of formatting and parsing back.
OWASP: Forgery and Phishing

Learn the techniques to avoid forgery and phishing attacks and the types of attacks an application or network may face.

Manikandan ThiagarajanSenior consultantCommented:
jjacksnAuthor Commented:
objects, not sure what you mean...?
Mick BarryJava DeveloperCommented:
you're talkikng a date and formatting it as a string then back to a date again.
Why can't you just use the original date instance instead of parsing the string?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.