您的位置:首页 > 其它

格林威治时间计算

2015-08-04 15:40 211 查看
public class Test {
public static void main(String args[])
{
Calendar c = Calendar.getInstance();
c.setTimeInMillis(1234567890123L);
int year = c.get(Calendar.YEAR);
//注意:month特殊,是从0开始的,也就是0表示1月
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
System.out.println("设置的时间是" + year + "年" + (month + 1) + "月" + day+ "日");
}
}

//运行结果:设置的时间是 2009 年 2 月 14 日
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: