如何将DateTime转换为以下格式的毫秒制Android?

时间:2018-07-17 11:00:29

标签: java

2018-07-12T00:00:00.000+05:30成毫秒?让我知道如何转换

@Override
public void onDateSelected(@NonNull final DateTime dateSelected) {
    // log it for demogetdata();

    Log.i("HorizontalPicker", "Selected date is " + dateSelected.toString());
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-ddHH:mm:ss z");
    try {
        Date mDate = sdf.parse(dateSelected.toString());
        long timeInMilliseconds = mDate.getTime();
        System.out.println("Date in milli :: " + timeInMilliseconds);
        getdata(timeInMilliseconds);

    } catch (ParseException e) {
        e.printStackTrace();
    }


}

0 个答案:

没有答案