Bigkoo / Android-PickerView

This is a picker view for android , support linkage effect, timepicker and optionspicker.(时间选择器、省市区三级联动)
Apache License 2.0
13.45k stars 3.45k forks source link

选择小的年份如(1960),获取的时间戳,解析出来与选择年月不匹配 #392

Closed puxiaoshuai closed 7 years ago

puxiaoshuai commented 7 years ago

如选择 1965-09-19,用date.gettime()获取到时间搓为-135209440000, 选择1971-09-19,时间搓为54093438000,都不匹配, 但是选择 2017-09-19,时间搓为1505786352000,是匹配的

xiaosong520 commented 7 years ago

@Dandelionboy帮你看了一下,是没有问题的, http://tool.chinaz.com/Tools/unixtime.aspx 可以到这个网站自行转化一下。

puxiaoshuai commented 7 years ago

//时间选择器 TimePickerView pvTime = new TimePickerView.Builder(this, new TimePickerView.OnTimeSelectListener() { @Override public void onTimeSelect(Date date, View v) {//选中事件回调 SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd"); String time = simpleDateFormat.format(date);

                    date.getTime();

                }
            }).setType(new boolean[]{true, true, true, false, false, false}).
                    setSubmitColor(R.color.allbackground).build();
            pvTime.show();

如上,调试打印 date.getTime();就出现上述问题,难道我打开方式不对,?

xiaosong520 commented 7 years ago

@Dandelionboy 你拿你测试的那几个数据自己去转化一下看是不是正确的,单位选择的是毫秒。本来就没有问题呀。