httpgmttimestamp.java
来自「21天学通java的示例程序源代码」· Java 代码 · 共 34 行
JAVA
34 行
// HTTPGMTTimestamp.java
package com.wrox.httpserver;
import java.text.*;
import java.util.*;
/**
* Encapsulates a GMT timestamp.
*/
class HTTPGMTTimestamp {
// Instance variable
private Date currentTime;
// Class variable
private static SimpleDateFormat formatter =
new SimpleDateFormat("d MMM yyyy hh:mm:ss 'GMT'", Locale.US);
/**
* Consructs the current GMT timestamp.
*/
public HTTPGMTTimestamp() {
currentTime = new Date();
}
/**
* Returns a formatted GMT timestamp.
*/
public String toString() {
return formatter.format(currentTime);
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?