Changeset 46 for sample/hadoop-0.16/test.java
- Timestamp:
- Jul 25, 2008, 6:26:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/hadoop-0.16/test.java
r45 r46 7 7 import java.io.IOException; 8 8 import java.io.RandomAccessFile; 9 import java.text.ParsePosition; 9 10 import java.text.SimpleDateFormat; 10 11 import java.util.Date; … … 252 253 } 253 254 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); 257 259 Date timestamp = sdf.parse(da); 260 long timeint = timestamp.getTime(); 258 261 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 259 282 } 260 283 … … 278 301 // 測試 enum 列舉 279 302 // t.enumTest(); 280 t.Date(); 303 // 測試設定 304 // t.Date(); 305 // 測試取得現在時間 306 // t.getNowTime(); 307 t.setTime(); 281 308 } 282 309
Note: See TracChangeset
for help on using the changeset viewer.