Java时间日期格式转换解析.doc

Java时间格式转换大全 import java.text.*; import java.util.Calendar; public class VeDate { /** * 获取现在时间 * * @return 返回时间类型 yyyy-MM-dd HH:mm:ss */ public static Date getNowDate() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat(yyyy-MM-dd HH:mm:ss); String dateString = formatter.format(currentTime); ParsePosition pos = new ParsePosition(8); Date currentTime_2 = formatter.parse(dateString, pos); return currentTime_2; } /** * 获取现在时间 * * @return返回短时间格式 yyyy-MM-dd */ DateFormat format1 = new SimpleDateFormat(yyyy-MM-dd);

文档评论(0)

1亿VIP精品文档

相关文档