package com.wanda.sso.client.servlet;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
/**
* 以下给出一个windows下取到具体时间的程序:
*
* @author iSoftStone
*/
public class FirstTest {
/** Creates a new instance of FirstTest */
public FirstTest() {
}
public static void main(String[] args) {
try {
Process p = Runtime.getRuntime().exec(
"cmd /C dir D:\\workspace\\ssoClient\\WEB-INF\\Setting.xml /tc");
InputStream is = p.getInputStream();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String str;
int i = 0;
while ((str = br.readLine()) != null) {
i++;
if (i == 6) {
System.out.println(str.substring(0, 17));
}
}
} catch (java.io.IOException exc) {
exc.printStackTrace();
}
}
}
关于Date类的介绍:
http://www.cjsdn.net/doc/jdk50/java/util/class-use/Date.html