国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
JAVA常用的時間格式化方法
/**
 * 根據(jù)想得到的時間格式返回string
 * @parma formatStyle 要格式化的格式 e.g:yyyy-MM-dd HH:mm:ss
 * @param date
 * @return
 */
public static String getFormatDate(String formatStyle) {
return new SimpleDateFormat(formatStyle).format(new Date().getTime());
}
/**
 * 根據(jù)想得到的時間格式返回string
 * @parma formatStyle 要格式化的格式 e.g:yyyy-MM-dd HH:mm:ss
 * @param time
 * @return
 */
public static String getFormatDate(String formatStyle,Date time) {
return new SimpleDateFormat(formatStyle).format(time);
}
/**
 * 把形式為yyyy-MM-dd HH:mm:ss的字符串轉(zhuǎn)化為Date
 * @param strDate
 * @return
 */
public static Date convertStrToDate(String strDate) {
Date date = null;
try {
date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(strDate);
} catch (ParseException e) {
System.out.println("convert string to date error!");
e.printStackTrace();
}
return date;
}
/**
 * 得到日期字符串形式為20080908
 * @return
 */
public static  String getChinaDateString() {
    int year = calendar.get(Calendar.YEAR);
    int month = calendar.get(Calendar.MONTH)+1;
    int date = calendar.get(Calendar.DATE);
    String strYear = String.valueOf(year);
    String strMonth = month<10? "0"+ month : String.valueOf(month);       
    String strDate = date<10? "0"+date : String.valueOf(date);       
    return strYear+strMonth+strDate;
}
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
java創(chuàng)建jar包并被項目引用
java 日期與字符串轉(zhuǎn)化 - - JavaEye技術(shù)網(wǎng)站
Java時間和時間戳的相互轉(zhuǎn)換
Java基礎(chǔ):Java操作日期的工具類總結(jié)
Date與String之前的轉(zhuǎn)化問題
時間,日期操作類 - baby69yy2000 - JavaEye技術(shù)網(wǎng)站
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服