毫秒值转换为日期格式:

@Test
	public void test(){
		Date date = new Date(235959);
		SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		String time = formatter.format(date);
		System.out.println("对应毫秒值的时间"+time);

    }

日期转换为毫秒值:

@Test
    public void date() throws ParseException {

	    String beginDate = "1970-01-01 08:03:55";
        Date date = null;
        SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        date = sdf.parse(beginDate);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        System.out.println("对应时间的毫秒值="+calendar.getTimeInMillis());

    }