private static void addDate(Element elemAdd, String field, String value)
{
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
try
{
Date dt = sdf.parse(value);
SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");
addString(elemAdd, field, df.format(dt));
}
catch ( Exception any )
{
}
}
private static void addTime(Element elemAdd, String field, String value)
{
SimpleDateFormat sdf = new SimpleDateFormat("HHmm");
try
{
Date dt = sdf.parse(value);
SimpleDateFormat df = new SimpleDateFormat("HH:mm");
addString(elemAdd, field, df.format(dt));
}
catch ( Exception any )
{
}
}
private static void addString(Element elemAdd, String field, String value)
{
if ( value.length() > 0 )
{
elemAdd.setAttribute(field, value.trim());
}
}
shared items
Friday, September 5, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment