Ignore:
Timestamp:
Jul 25, 2008, 6:26:50 PM (16 years ago)
Author:
waue
Message:

SnortBase? -> complete and work fine ..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sample/hadoop-0.16/test.java

    r45 r46  
    77import java.io.IOException;
    88import java.io.RandomAccessFile;
     9import java.text.ParsePosition;
    910import java.text.SimpleDateFormat;
    1011import java.util.Date;
     
    252253  }
    253254
    254   void Date()throws Exception{
    255     String da = "20/Jul/2008:08:26:55";
    256     SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss",Locale.US);
     255  void Date() throws Exception {
     256    String da = "10/Jul/2008:08:26:55";
     257    SimpleDateFormat sdf = new SimpleDateFormat("dd/MMM/yyyy:HH:mm:ss",
     258        Locale.US);
    257259    Date timestamp = sdf.parse(da);
     260    long timeint = timestamp.getTime();
    258261    System.out.println(timestamp.toString());
     262    System.out.println(timeint);
     263  }
     264
     265  void getNowTime() {
     266    SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
     267    Date date = new Date();
     268    String strDate = sdFormat.format(date);
     269    System.out.println(strDate);
     270    System.out.println(date.getTime());
     271  }
     272
     273  void setTime() {
     274    String str = "07/08:01:01:01";
     275    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM:HH:mm:ss",
     276        Locale.TAIWAN);
     277    Date tim = sdf.parse(str, new ParsePosition(0));
     278    System.out.println(tim);
     279    Long timestamp = tim.getTime();
     280    System.out.println(timestamp);
     281
    259282  }
    260283
     
    278301    // 測試 enum 列舉
    279302    // t.enumTest();
    280     t.Date();
     303    // 測試設定
     304    // t.Date();
     305    // 測試取得現在時間
     306    // t.getNowTime();
     307    t.setTime();
    281308  }
    282309
Note: See TracChangeset for help on using the changeset viewer.