java编写一个类显示出当前日期_编写一个日期功能类:DateFunction 有如下方法:...

编写一个日期功能类:DateFunction 有如下方法:

(1) public static java.uitl.Date getCurrentDate() //取得当前日期

(2 )public static String getCurrentShortDate () //返回当前年月日格式日期:yyyy-mm-dd

(3) public static String getCurrentDateTime() //取得当前日期和时间 格式:yyyy-mm-dd hh:mi:ss

(4) public static String getCurrentChineseDate() //返回 “yyyy年xx月xx日”格式的日期

(5) public static java.util.Date convertToDate(String currentDate) throws Exception //将字符串日期转换为日期类型, 字符串格式为:yyyy-mm-dd, 如果转换失败,抛出转换异常

(6) public static java.util.Date convertToLongDate(String currentDate) throws ConvertException //将日期时间:yyyy-mm-dd hh:mi:ss 转换为日期类型,如果转换失败抛出转换异常。

(7) public static String convertToDateString(java.sql.Date  date) //将日期类型转换为字符串类型,格式:yyyy-mm-dd

(8) public static String convertToDateTimeString(java.sql.Date date) //将日期转换为字符串,格式为:yyyy-mm-dd hh:mi:ss

编写测试类Test,对所有方法进行测试。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值