javaÈÕÆÚ´¦Àí
ת£º http://hi.baidu.com/jiong0818/blog/item/93f9b21641294b4d20a4e971.html JavaÖÐÈÕÆÚ¸ñʽת»» /** * ×Ö·û´®×ª»»Îªjava.util.Date
* Ö§³Ö¸ñʽΪ yyyy.MM.dd G 'at' hh:mm:ss z Èç '2002-1-1 AD at 22:10:59 PSD'
* yy/MM/dd HH:mm:ss Èç '2002/1/1 17:55:00'
* yy/MM/dd HH:mm:ss pm Èç '2002/1/1 17:55:00 pm'
* yy-MM-dd HH:mm:ss Èç '2002-1-1 17:55:00'
* yy-MM-dd HH:mm:ss am Èç '2002-1-1 17:55:00 am'
* @param time String ×Ö·û´®
* @return Date ÈÕÆÚ
*/ public static Date stringToDate(String time){ SimpleDateFormat formatter; int tempPos=time.indexOf("AD") ; time=time.trim() ; formatter = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss z"); if(tempPos>-1){ time=time.substring(0,tempPos)+ "¹«Ôª"+time.substring(tempPos+"AD".length());//china formatter = new SimpleDateFormat ("yyyy.MM.dd G 'at' hh:mm:ss z"); } tempPos=time.indexOf("-"); if(tempPos>-1&&(time.indexOf(" ")<0)){ formatter = new SimpleDateFormat ("yyyyMMddHHmmssZ"); } else if((time.indexOf("/")>-1) &&(time.indexOf(" ")>-1)){ formatter = new SimpleDateFormat ("yyyy/MM/dd HH:mm:ss"); } else if((time.indexOf("-")>-1) &&(time.indexOf(" ")>-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); } else if((time.indexOf("/")>-1) &&(time.indexOf("am")>-1) ||(time.indexOf("pm")>-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd KK:mm:ss a"); } else if((time.indexOf("-")>-1) &&(time.indexOf("am")>-1) ||(time.indexOf("pm")>-1)){ formatter = new SimpleDateFormat ("yyyy-MM-dd KK:mm:ss a"); } ParsePosition pos = new ParsePosition(0); java.util.Date ctime = formatter.parse(time, pos); return ctime; } /** * ½«java.util.Date ¸ñʽת»»Îª×Ö·û´®¸ñʽ'yyyy-MM-dd HH:mm:ss'(24СʱÖÆ)
* ÈçSat May 11 17:24:21 CST 2002 to '2002-05-11 17:24:21'
* @param time Date ÈÕÆÚ
* @return String ×Ö·û´®
*/ public static String dateToString(Date time){ SimpleDateFormat formatter; formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); String ctime = formatter
Ïà¹ØÎĵµ£º
ÓÉÓÚ Source Insight µÄ´úÂëÒ׶ÁµÄÓÅÔ½ÐÔÄÜ,£¬Ê¹Óà Source Insight ±à¼ Java ´úÂëÊÇÒ»¸ö²»´íµÄÑ¡Ôñ£¬µ±È»Ëü²»ÄÜÓëרҵµÄ Eclipse ¼° Netbeans ÕâÑùµÄIDE Ïà±È£»
±¾ÈËʹÓÃËüÊÇÒòΪ Source Insight µÄÌå»ý±È½ÏС£¬¿ÉÒÔ×Ô¶¨ÒåÉèÖÃÓû§ÃüÁÓÃÆðÀ´Ò²ËãÊǵÃÐÄ ......
¡¡
¡¡ÔÚJavaÖУ¬thisͨ³£Ö¸µ±Ç°¶ÔÏó£¬superÔòÖ¸¸¸ÀàµÄ¡£µ±ÄãÏëÒªÒýÓõ±Ç°¶ÔÏóµÄijÖÖ¶«Î÷£¬±ÈÈ統ǰ¶ÔÏóµÄij¸ö·½·¨£¬»òµ±Ç°¶ÔÏóµÄij¸ö³ÉÔ±£¬Äã±ã
¿ÉÒÔÀûÓÃthisÀ´ÊµÏÖÕâ¸öÄ¿µÄ£¬µ±È»£¬thisµÄÁíÒ»¸öÓÃ;Êǵ÷Óõ±Ç°¶ÔÏóµÄÁíÒ»¸ö¹¹Ô캯Êý£¬ÕâЩÂíÉϾÍÒªÌÖÂÛ¡£Èç¹ûÄãÏëÒýÓø¸ÀàµÄijÖÖ¶«Î÷£¬Ôò·Ç
superĪÊô¡£ÓÉÓÚthi ......
1. ÒýÑÔ
¡¡¡¡½üÄêÀ´£¬Ëæ×ÅInternet/Intranet½¨Íø¼¼ÊõµÄ·ÉËÙ·¢Õ¹ºÍÔÚÊÀ½ç·¶Î§ÄÚµÄѸËÙÆÕ¼°£¬¼ÆËã»ú
¡¡¡¡Ó¦ÓóÌÐòÒÑ´Ó´«Í³µÄ×ÀÃæÓ¦ÓÃתµ½WebÓ¦Ó᣻ùÓÚB/S£¨Browser/Server£©¼Ü¹¹µÄ3²ã¿ª·¢Ä£Ê½Öð½¥È¡´úC/S£¨Client/Server£©¼Ü¹¹µÄ¿ª·¢Ä£Ê½£¬³ÉΪ¿ª·¢ÆóÒµ¼¶Ó¦Óú͵ç×ÓÉÌÎñÆÕ±é²ÉÓõļ¼Êõ¡£ÔÚWebÓ¦Óÿª·¢µÄÔçÆÚ£¬Ö÷ҪʹÓõ ......
Java Web Start ÊÇÒ»¸öhelperÓ¦ÓóÌÐò£¬ËüºÍWEBä¯ÀÀÆ÷¹ØÁªÔÚÒ»Æð¡£µ±Óû§µã»÷Ö¸ÏòÒ»¸öÌض¨µÄlaunchÎļþ(JNLPÎļþ)ʱ£¬»á´Ùʹä¯ÀÀÆ÷×°ÔØJava Web Start, JAWSÈ»ºó×Ô¶¯ÏÂÔØ¡¢»º³å¡¢ÔËÐиø¶¨µÄ»ùÓÚJAVA¼¼ÊõµÄÓ¦ÓóÌÐò¡£Õû¸ö¹ý³ÌÎÞÐèºÍÓû§½øÐн»»¥¡£
JNLP URLsÒ²¿ÉÒÔ´ÓJAWSÓ¦ÓóÌÐò¹ÜÀíÖ±½Ó´ò¿ª²¢ÇÒÄÜÖƳÉÊéÇ©,´ËÍ⣠......
JSPÔ´´úÂë
<%
//»ñȡϵͳʱ¼ä
//String ddate=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());
TimeZone tz = TimeZone.getTimeZone("ETC/GMT-8");
TimeZone.setDefault(tz);
  ......