jjacksn
asked on
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 (DateForma t.FULL, Locale.US);
gmtFormat.setTimeZone(Time Zone.getTi meZone("GM T"));
}
and then later
writeChildElement(elt, "TimeStamp", gmtFormat.format(timeStamp ));
mde.setTimeStamp(gmtFormat .parse(sel ectedElt.g etText())) ;
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?
private static DateFormat gmtFormat;
static {
gmtFormat = DateFormat.getDateInstance
gmtFormat.setTimeZone(Time
}
and then later
writeChildElement(elt, "TimeStamp", gmtFormat.format(timeStamp
mde.setTimeStamp(gmtFormat
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?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
objects, not sure what you mean...?
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?
Why can't you just use the original date instance instead of parsing the string?
Why aren't you just using the original Date object instead of formatting and parsing back.