自己做了强制转换:
/**
* LeanCloud的Date转能使用的Date
* 入参string:
* * LeanCloud:Tue Mar 31 11:07:44 GMT+08:00 2020
* * Gson把LeanCloud格式变成: Mar 31, 2020 11:07:44 不可本地使用
* * 所以要转化一下
* @param string
* @return
*/
public static Date leancloudDateStringToDate(String string) {
//SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy K:m:s a", Locale.ENGLISH);
SimpleDateFormat sdf = new SimpleDateFormat("MMM d, yyyy K:m:s", Locale.ENGLISH);
Date d2 = null;
try {
d2 = sdf.parse(string);
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println("d2 ====== "+d2);
return d2;
}