我有完全相同的问题,我用这个简单的代码解决了它
public class Json {
/**
* Convertit une date Json en java.util.Date
* @param jsonDate
* @return
*/
public static Date JsonDateToDate(String jsonDate)
{
// "/Date(1321867151710+0100)/"
int idx1 = jsonDate.indexOf("(");
int idx2 = jsonDate.indexOf(")") - 5;
String s = jsonDate.substring(idx1+1, idx2);
long l = Long.valueOf(s);
return new Date(l);
}
}
Run Code Online (Sandbox Code Playgroud)
如果你使用gson,你也可以使用该解决方案:MS WCF兼容形式的日期字段的gson序列化
| 归档时间: |
|
| 查看次数: |
3441 次 |
| 最近记录: |