java Calendar类
程序员文章站
2022-03-19 21:37:23
public class CalendarDemo { public static void main(String[] args) { Date d = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy"); String ......
public class calendardemo { public static void main(string[] args) { date d = new date(); simpledateformat sdf = new simpledateformat("yyyy"); string year = sdf.format(d); system.out.println(year); calendar c = calendar.getinstance(); //可以使用查表法月份查询 system.out.println(c.get(calendar.year)+"年"+(c.get(calendar.month)+1)+"月"+c.get(calendar.day_of_month)+"日"); } }
public class calendardemo { public static void main(string[] args) { calendar c = calendar.getinstance(); c.set(2012,2,23); system.out.println(c.get(calendar.year)+"年"+(c.get(calendar.month)+1)+"月"+c.get(calendar.day_of_month)+"日"); c.add(calendar.year,-4); system.out.println(c.get(calendar.year)+"年"+(c.get(calendar.month)+1)+"月"+c.get(calendar.day_of_month)+"日"); } }
推荐阅读
-
零基础写Java知乎爬虫之准备工作
-
理解PHP中的stdClass类_PHP教程
-
phpstorm9 phpunit debug总是找不到基类
-
JAVA工具类——(Collections类和Arrays类)
-
php实现在限定区域里自动调整字体大小的类实例
-
java Collections,Arrays工具类集合
-
Java在Web开发语言上败给了PHP????
-
【收藏】php生成中文汉字首拼音实用类
-
整合SSM之springmvc 报错:No converter found for return value of type: class java.util.ArrayList
-
解决No converter found for return value of type: class java.util.ArrayList