Convert sql timestamp to yyyy-mm-ddThh:mm:ss.sssZ
I need to convert a SQL Server timestamp format (stored on Timestamp java data type) into this format yyyy-mm-ddThh:mm:ss.sssZ (it's the d开发者_如何转开发ate format parsed by Alfresco)
How can I do it?
thanks for your time!
Andrea
Try this SimpleDateFormat:
SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'" );
String yourformattedDate = sdf.format(yourDate);
You could try and get the time (in ms) from your TimeStamp instance, create a Date instance and use the DateFormatter class to format it anyway you want. That is, assuming DateFormatter supports the format you want.
精彩评论