首页 > 学院 > 开发设计 > 正文

Java核心代码例程之:CalendarDemo.java

2019-11-18 15:15:02
字体:
来源:转载
供稿:网友

import java.util.*;

/**
 * Demo Calendar class.
 ***/
public class CalendarDemo
{
    public static void main(String args[]) throws Exception
    {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(new Date());
        
        System.out.PRintln((cal.get(Calendar.MONTH)+1) + "/" + 
                           cal.get(Calendar.DAY_OF_MONTH) + "/" +
                           cal.get(Calendar.YEAR));
    }
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表