javaÈÕÆÚ´¦Àí - Java / Java SE
µ±ÖªµÀÒ»¸öÈÕÆÚ£¬ÈçºÎ°ÑÕâ¸öÈÕÆÚËùÔÚÑ®µÄÇ°ºóÁ½¸öÈÕÆÚÈ¡³ö
±ÈÈçÊäÈë20090905£¬¾ÍÊäÈë20090901 20090910
Êä³ö20090901 20090910
È¡µÃÌìÊýºó×÷Ò»ÏÂÅжÏÔÙ°ÑÕâ¸ö·½·¨ÓÃÏÂvoid set(int field, int value)
Ó¦¸Ã¾Í¿ÉÒÔÁË¡£
·ÖÉÙÁË°É
Ñ®?
ÏȽØÈ¡³öÄêÔÂÈÕ (d="20090905")
year=Integer.valueOf(d.substring(0,4));
month=Integer.valueOf(d.substring(4,6));
day=Integer.valueOf(d.substring(6,8));
ÔÙÓÃdayÈ¥ÅжÏÔÚÄĸöÑ®ÄÚ ÓÃ×Ö·û´®µÄappend()·½·¨×·¼Ó¾Í¿ÉÒÔÁË°É ¶ÔÓÚÂ¥Ö÷ÕâÑùµÄÐèÇó
public String getTime(String s){
java.util.Date d=null;
try {
d=(java.util.Date)new SimpleDateFormat("yyyyMMdd").parse(s);
} catch (ParseException e) {
e.printStackTrace();
}
String s1=new java.sql.Date(d.getTime()-5*86400000).toString().replaceAll("-", "");//Ç°5Ìì
String s2=new java.sql.Date(d.getTime()+5*86400000).toString().replaceAll("-", "");//ºó5Ìì
System.out.println(s1+" "+s2);
return s1+" "+s2;
}
дÍê²Å·¢ÏÖ£¬Ã²ËƲ»ÊÇÂ¥Ö÷ÒªµÄ£¬²»ºÃÒâ˼¡£
ÕâÑù¾Í¿ÉÒÔÁËô¡£
public static void getTime() {
String str = "20090225";
StringBuilder sb = new StringBuilder();
Date date = null;
try {
date = dateformat.parse(str);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.p[code=Java][/c
Ïà¹ØÎÊ´ð£º
ÎÒÄ¿Ç°ÔÚ±¾µØµÄlinuxÉÏдÁËÒ»¸öswingµÄ½çÃ棬Ïëͨ¹ýÕâ¸ö½çÃæÀ´¿ØÖÆÆäËüµçÄÔµÄlinuxÖØÆô¡£
ÎÒÖªµÀÓÃRuntime.getRuntime().exec("shutdown -r");¿ÉÒÔ¿ØÖƱ¾»úLinuxÖØÆô£¬µ«ÊÇÔõô¿ØÖÆÔ¶³ÌµÄlinuxÖØÆôÄØ£¿ ......
ÎÒÔÚeclipseÖÐдÁËÒ»¸ö²¥·ÅÒôÀÖµÄÀ࣬²¢°ÑÒôÀÖÎļþºÍÀàÎļþ·ÅÔÚÁËÒ»Æ𣬽á¹ûÔËÐÐʱ£¬³öÏÖ´íÎó£¬ËµÊÇÒôÀÖÎļþÄǸöÊǿյģ¬µ«ÊÇÔÚjcreatorÓÃͬÑùµÄ·½·¨½á¹ûÊÇ¿ÉÒÔÔËÐеģ¬ÇëÇó¸ß˵ָ½Ì£¬¸æËßΪʲô£¿¼±
ÄãÈôÊÇÔÚWindo ......
²àÖØÓÚ»¥ÁªÍø¿ª·¢
JAVA¿ª·¢¹¤³Ìʦ
ְλÃèÊö£º
1¡¢°´USECASE½øÐÐÒµÎñÐèÇó·ÖÎöºÍÈí¼þ¸ÅÒªÉè¼Æ£»
2¡¢½øÐÐÈí¼þÏêϸÉè¼ÆºÍ±àÂëʵÏÖ£¬È·±£ÐÔÄÜ¡¢ÖÊÁ¿ºÍ°²È«£»
3¡¢Î¬»¤ºÍÉý¼¶ÏÖÓÐÈí¼þ²úÆ·£¬¿ìËÙ¶¨Î»² ......
import java.io.*;
class FileTest
{
public static void main(String [] args) throws Exception
{
File fDir=new File(File.separator);
String strFile="javaÔ´´úÂë²âÊÔ"+File.separato ......