将格林威治时间转换为北京时间

	Date nowTime = new Date(); // 要转换的时间
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(nowTime.getTime());
        
        Log.i("OTH","北京时间:" + cal.getTime().toString().substring(0, 19));
        
        cal.add(Calendar.HOUR, -8);
        Log.i("OTH","格林威治时间:" + cal.getTime());

你可能感兴趣的:(Date,calendar)