繁体   English   中英

服务器时间戳到字符串的错误转换

[英]Incorrect conversion of server timestamp to String

我正在尝试从服务器获取的时间戳的ArrayList中设置ListView的适配器中的日期。

 Date date = new Date(news_date.get(position) * 1000);
 SimpleDateFormat sdf= new SimpleDateFormat("dd.MM.yy");
 ((TextView) view.findViewById(R.id.newsTvDate)).setText(sdf.format(date));

这是我的日志:

12-12 19:00:23.234: D/MyLog(13086):  news_date.get(position)=1385323200
12-12 19:00:23.254: D/MyLog(13086):  news_date.get(position)=1384718400
12-12 19:00:23.266: D/MyLog(13086):  news_date.get(position)=1384113600
12-12 19:00:23.275: D/MyLog(13086):  news_date.get(position)=1383508800
12-12 19:00:23.291: D/MyLog(13086):  news_date.get(position)=1383076800
12-12 19:00:55.426: D/MyLog(13086):  news_date.get(position)=1382904000

结果我看到类似02.01.70,26.12.69等的信息我该如何解决?

整数溢出。

例如, 1385323200 * 1000太大而无法容纳32位整数。 首先将其中一个操作数提升为64位整数: 1385323200 * 1000L

您可能在news_date.get(位置)中输入了错误的数字,请尝试找出原因

编辑:

错误的意思是接近0的东西:P

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM