I have table with data of date.
This is how I calcaulted the date
DateFormat dateFormat = getFormat();
date = dateFormat.parse((String) value).getTime();
if(date != null) {
cell.setValue(dateFormat.format(date));
tableViewer.update(element, null);
}
public static DateFormat getFormat() {
String systemLocale = System.getProperty("user.language"); //$NON-NLS-1$
Locale locale = new Locale(systemLocale);
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
return dateFormat;
}
The date is exist in the screen in format Month(name of the month) date, year
for example Apr 26,2014.
Now I want to get the value of the cell and to get to format of 'yyyy-mm-dd' The value of the date is Apr 26,2014. How I can get the result of 2014-04-26 ? also I think that the value in the UI could change according to the localization of the user
I tried
DateFormat dateFormat = getFormat();
Date parse = dateFormat.parse((String) key);
but then all the get method are deprecated and also I didn't get right result for getYear
I am not expert in the date maybe I miss something