I’m wondering if there any gotchas or something like this with plain java new Date()
I’m using it throughout my app to get current timestamp.
However, I’m seeing (occasionaly) results that out of whack. Like those dates from the future.. Any idea why something like this might happen? I’m also using following functions to convert this data to and from strings..

private final static SimpleDateFormat databaseDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
static
{
databaseDateFormat.setTimeZone(TimeZone.getTimeZone("gmt"));
}
public static String getDateConvertedToUTCDBString(Date date)
{
return databaseDateFormat.format(date);
}
public static Date getDateConvertedFromDBString(String date)
{
try
{
return localDatabaseDateFormat.parse(date);
}
catch(java.text.ParseException e)
{
return null;
}
}
SimpleDateFormat is not thread-safe, so make sure that you don’t use the same instance from different threads, otherwise data parsing may become invalid. You can use ThreadLocal to create SimpleDateFormat instance per thread.