我可以从日期选择器获取毫秒日期值吗?(自 1970 年以来的毫秒值) [英] Can I get milliseconds date value from a datepicker? (the milliseconds since 1970 value)

查看:10
本文介绍了我可以从日期选择器获取毫秒日期值吗?(自 1970 年以来的毫秒值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 DatePicker d;我需要获取日期的毫秒值.(自 1970 年以来的毫秒数)

I have a DatePicker d; and I need to get the milliseconds value of the date. (the milliseconds since 1970 value)

我该怎么做?

推荐答案

创建日历对象并从日期选择器和 today.getTimeInMillis() 设置日期和时间.

Create a calender object and set the date and time from the date picker and today.getTimeInMillis().

onDateSet(...) {
    Calendar c = Calendar.getInstance();
    c.set(...);
    long mills = c.getTimeInMillis();
}

这篇关于我可以从日期选择器获取毫秒日期值吗?(自 1970 年以来的毫秒值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆