日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

excel2003 java_java 读取 excel 2003 或 excel 2007

發(fā)布時(shí)間:2023/12/15 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 excel2003 java_java 读取 excel 2003 或 excel 2007 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

#?re: java 讀取 excel 2003 或 excel 2007

2012-10-15 22:44

惠萬鵬

public class DateUtil

{

/**

*

*

Description:[得到當(dāng)前的時(shí)間]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @return

*/

public static Date getDate()

{

Calendar canlendar = Calendar.getInstance();

return canlendar.getTime();

}

/**

*

*

Description:[提到指定的millis得到時(shí)間]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param millis

* @return

*/

public static Date getDate(long millis)

{

Calendar canlendar = Calendar.getInstance();

canlendar.clear();

canlendar.setTimeInMillis(millis);

return canlendar.getTime();

}

public static long getMillis()

{

return Calendar.getInstance().getTimeInMillis();

}

/**

*

*

Description:[得到指定日期的字符串(yyyy-MM-dd HH:mm:ss.SSS)]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @param formate

* @return

*/

public static String getDateFormate(Date date, String formate)

{

try

{

SimpleDateFormat simpleDateFormate = new SimpleDateFormat(formate);

return simpleDateFormate.format(date);

}

catch (Exception e)

{}

return "";

}

/**

*

*

Description:[根據(jù)日期得到Y(jié)YYY-MM-DD HH:MM:SS.SSS格式字符串]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @return

*/

public static String get4yMdHmsS(Date date)

{

return DateUtil.getDateFormate(date, "yyyy-MM-dd HH:mm:ss.SSS");

}

/**

*

*

Description:[根據(jù)日期得到Y(jié)YYY-MM-DD HH:MM:SS格式字符串]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @return

*/

public static String get4yMdHms(Date date)

{

return DateUtil.getDateFormate(date, "yyyy-MM-dd HH:mm:ss");

}

/**

*

*

Description:[根據(jù)日期得到Y(jié)YYY-MM-DD HH:MM格式字符串]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @return

*/

public static String get4yMdHm(Date date)

{

return DateUtil.getDateFormate(date, "yyyy-MM-dd HH:mm");

}

/**

*

*

Description:[根據(jù)日期得到Y(jié)YYY-MM-DD格式字符串]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @return

*/

public static String get4yMd(Date date)

{

return DateUtil.getDateFormate(date, "yyyy-MM-dd");

}

/**

*

*

Description:[把指定字符(yyyy-MM-dd HH:mm:ss.SSS)串轉(zhuǎn)成Date]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param sDate

* @return

*/

public static Date parse4yMdHmsS(String sDate)

{

return DateUtil.parseDate(sDate, "yyyy-MM-dd HH:mm:ss.SSS");

}

/**

*

*

Description:[把指定字符(yyyy-MM-dd HH:mm:ss)串轉(zhuǎn)成Date]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param sDate

* @return

*/

public static Date parse4yMdHms(String sDate)

{

return DateUtil.parseDate(sDate, "yyyy-MM-dd HH:mm:ss");

}

/**

*

*

Description:[把指定字符(yyyy-MM-dd HH:mm)串轉(zhuǎn)成Date]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param sDate

* @return

*/

public static Date parse4yMdHm(String sDate)

{

return DateUtil.parseDate(sDate, "yyyy-MM-dd HH:mm");

}

/**

*

*

Description:[把指定字符(yyyy-MM-dd)串轉(zhuǎn)成Date]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param sDate

* @return

*/

public static Date parse4yMd(String sDate)

{

return DateUtil.parseDate(sDate, "yyyy-MM-dd");

}

/**

*

*

Description:[根據(jù)指定格式,把字符串轉(zhuǎn)成日期]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param sDate

* @param formate

* @return

*/

public static Date parseDate(String sDate, String formate)

{

SimpleDateFormat simpleDateFormate = new SimpleDateFormat(formate);

try

{

return simpleDateFormate.parse(sDate);

}

catch (ParseException e)

{

return null;

}

}

/**

*

*

Description:[兩個(gè)長(zhǎng)整型的時(shí)間相差(時(shí)間的毫秒數(shù)),可以得到指定的毫秒數(shù),秒數(shù),分鐘數(shù),天數(shù)]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param minuendTime[被減去的時(shí)間]

* @param subtrahendTime[減去的時(shí)間]

* @param tdatestr[part可選值["D","H","M","S","MS"]

* @return[minuendTime-subtrahendTime]

* @return

*/

public static double getDifTwoTime(Date minuendTime, Date subtrahendTime,

String tdatestr)

{

if (minuendTime == null || subtrahendTime != null)

{

return DateUtil.getDifTwoTime(minuendTime.getTime(), subtrahendTime

.getTime(), tdatestr);

}

return 0;

}

/**

*

*

Description:[兩個(gè)長(zhǎng)整型的時(shí)間相差(時(shí)間的毫秒數(shù)),可以得到指定的毫秒數(shù),秒數(shù),分鐘數(shù),天數(shù)]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param minuendTime[被減去的時(shí)間]

* @param subtrahendTime[減去的時(shí)間]

* @param tdatestr[part可選值["D","H","M","S","MS"]

* @return[minuendTime-subtrahendTime]

*/

public static double getDifTwoTime(long minuendTime, long subtrahendTime,

String tdatestr)

{

if (tdatestr == null || tdatestr.equals(""))

{

tdatestr = "MS";

}

double temp = 1;

/** 毫秒數(shù) */

if ("MS".equalsIgnoreCase(tdatestr))

{

temp = 1;

}

/** 得到秒 */

if ("S".equalsIgnoreCase(tdatestr))

{

temp = 1000;

}

/** 得到分 */

if ("M".equalsIgnoreCase(tdatestr))

{

temp = 1000 * 60;

}

/** 得到小時(shí) */

if ("H".equalsIgnoreCase(tdatestr))

{

temp = 1000 * 60 * 60;

}

/** 得到天 */

if ("D".equalsIgnoreCase(tdatestr))

{

temp = 1000 * 60 * 60 * 24;

}

return (minuendTime - subtrahendTime) / temp;

}

/**

*

*

Description:[從日期中得到指定部分(YYYY/MM/DD/HH/SS/SSS)數(shù)字]

*

Created by [Huyvanpull] [Oct 26, 2009]

*

Midified by [modifier] [modified time]

*

*

* @param date

* @param part[part可選值["Y","M","D","H","M","S","MS"]

* @return

*/

public static int getPartOfTime(Date date, String part)

{

Calendar canlendar = Calendar.getInstance();

canlendar.clear();

canlendar.setTime(date);

/** 得到年 */

if (part.equalsIgnoreCase("Y"))

{

return canlendar.get(Calendar.YEAR);

}

/** 得到月 */

if (part.equalsIgnoreCase("M"))

{

return canlendar.get(Calendar.MONTH) + 1;

}

/** 得到日 */

if (part.equalsIgnoreCase("D"))

{

return canlendar.get(Calendar.DAY_OF_MONTH);

}

/** 得到時(shí) */

if (part.equalsIgnoreCase("H"))

{

return canlendar.get(Calendar.HOUR_OF_DAY);

}

/** 得到分 */

if (part.equalsIgnoreCase("M"))

{

return canlendar.get(Calendar.MINUTE);

}

/** 得到秒 */

if (part.equalsIgnoreCase("S"))

{

return canlendar.get(Calendar.SECOND);

}

/** 得到毫秒 */

if (part.equalsIgnoreCase("MS"))

{

return canlendar.get(Calendar.MILLISECOND);

}

return -1;

}

}??回復(fù)??更多評(píng)論

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)

總結(jié)

以上是生活随笔為你收集整理的excel2003 java_java 读取 excel 2003 或 excel 2007的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。