将时间转换为毫秒,然后为这个时间制作一个通知管理器

convert time to millisecond then make a notification manger for this time

我正在尝试将这种格式的时间 00:00 转换为毫秒,但我如何知道转换是否正确? 样本: ||00:00 的时间,以毫秒为单位 >> 1459641652035 || ||14:20 的时间,以毫秒为单位 >> 1459693252035 || 这是我的代码

 Calendar calendar = Calendar.getInstance();
        TimeZone timezone =  TimeZone.getTimeZone("UTC+03:00");

        calendar.setTimeZone(timezone);

        Medicine obj1=new Medicine ();

        Long time[] = new Long[obj1.times.length];



        for (int i = 0; i < obj1.times.length; i++) {
//this loop to get each time (hour and Minute) and convert them to millisecond
            calendar.set(Calendar.HOUR_OF_DAY,Integer.parseInt(obj1.times[i].substring(0,2);
          calendar.set(Calendar.MINUTE,Integer.parseInt(obj1.times[i].substring(3, 5)));
     time[i] = calendar.getTimeInMillis();


        }


        return time;

    }

正确吗?

我也尝试这样做

hour= Integer.parseInt(obj1.times[i].substring(0, 2));
             min=Integer.parseInt(obj1.times[i].substring(3, 5));
             Milli=new Long((hour*60*60*1000)+(min*60*1000));
            time[i]=Milli;

但是这里我没有指定时区!这行得通吗?

你的样本是

||00:00 的时间,以毫秒为单位 >> 1459641652035 ||

很明显,00:00应该以毫秒为单位转换为0,所以转换不正确。