SimpleDateFormat fmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar c = Calendar.getInstance();
Date date1 = c.getTime();
Dtime = fmt.format(date1);
mTextView1.setText(Dtime); // display local time
int zoneOffset = c.get(java.util.Calendar.ZONE_OFFSET);
int dstOffset = c.get(java.util.Calendar.DST_OFFSET);
c.add(java.util.Calendar.MILLISECOND, -(zoneOffset + dstOffset));
Date date2 = c.getTime();
Dtime = fmt.format(date2);
mTextView2.setText(Dtime); // display utc time
没有评论:
发表评论