关于日期转换一个问题getEDate

mlc_ren 2012-04-12 02:45:38
系统时间转换为 September18,2009 格式:
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MMMMdd,yyyy",Locale.US);
String times = sdf.format(date);
return times;
通过以上代码可以实现现在的时间转换

但是现在我的代码里,String num= userInfo.getExpireDate();我已经得到我需要的日期。我需要怎么放进去?才可以转换?
...全文
48 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
java时间格式大全(算法源码) java,date,时间,时间格式,算法源码 * * @return */ public static String getTimeShort() { SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); Date currentTime = new Date(); String dateString = formatter.format(currentTime); return dateString; } /** * 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss * * @param strDate * @return */ public static Date strToDateLong(String strDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(strDate, pos); return strtodate; } /** * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss * * @param dateDate * @return */ public static String dateToStrLong(java.util.Date dateDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(dateDate); return dateString; } /** * 将短时间格式时间转换为字符串 yyyy-MM-dd * * @param dateDate * @param k * @return */ public static String dateToStr(java.util.Date dateDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String dateString = formatter.format(dateDate); return dateString; } /** * 将短时间格式字符串转换为时间 yyyy-MM-dd * * @param strDate * @return */ public static Date strToDate(String strDate) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(strDate, pos); return strtodate; } /** * 得到现在时间 * * @return */ public static Date getNow() { Date currentTime = new Date(); return currentTime; } /** * 提取一个月中的最后一天 * * @param day * @return */ public static Date getLastDate(long day) { Date date = new Date(); long date_3_hm = date.getTime() - 3600000 * 34 * day; Date date_3_hm_date = new Date(date_3_hm); return date_3_hm_date; } /** *

23,407

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧