Fix [ 1950305 ] Can't define default for Time fields

This commit is contained in:
Carlos Ruiz 2008-04-24 04:13:26 +00:00
parent 96dd2d3f66
commit 3e591b9194
2 changed files with 16 additions and 1 deletions

View File

@ -639,7 +639,13 @@ public class GridField
// Timestamps
if (DisplayType.isDate(m_vo.displayType))
{
java.util.Date date = DisplayType.getDateFormat_JDBC().parse (value);
// try timestamp format - then date format -- [ 1950305 ]
java.util.Date date = null;
try {
date = DisplayType.getTimestampFormat_Default().parse (value);
} catch (java.text.ParseException e) {
date = DisplayType.getDateFormat_JDBC().parse (value);
}
return new Timestamp (date.getTime());
}

View File

@ -350,6 +350,15 @@ public final class DisplayType
return new SimpleDateFormat ("yyyy-MM-dd");
} // getDateFormat_JDBC
/**
* JDBC Timestamp Format yyyy-mm-dd hh:mm:ss
* @return timestamp format
*/
static public SimpleDateFormat getTimestampFormat_Default()
{
return new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss");
} // getTimestampFormat_JDBC
/**
* Return Storage Class.
* (used for MiniTable)