博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
java 生成Http 头部date格式的string-RFC 1123 Date Representation in java
阅读量:4652 次
发布时间:2019-06-09

本文共 2295 字,大约阅读时间需要 7 分钟。

https://blog.csdn.net/lvzhuyiyi/article/details/51770148

*********************************************************************

RFC date format

import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Locale;import java.util.TimeZone;/** *  Common place for date utils. * * @author dac@eng.sun.com * @author Jason Hunter [jch@eng.sun.com] * @author James Todd [gonzo@eng.sun.com] * @author Costin Manolache */public class DateTool {    /**     * US locale - all HTTP dates are in english     */    public final static Locale LOCALE_US = Locale.US;    /**     * GMT timezone - all HTTP dates are on GMT     */    public final static TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT");    /**     * format for RFC 1123 date string -- "Sun, 06 Nov 1994 08:49:37 GMT"     */    public final static String RFC1123_PATTERN =        "EEE, dd MMM yyyy HH:mm:ss z";    /**      * Format for http response header date field     */    public static final String HTTP_RESPONSE_DATE_HEADER =        "EEE, dd MMM yyyy HH:mm:ss zzz";    // format for RFC 1036 date string -- "Sunday, 06-Nov-94 08:49:37 GMT"    private final static String rfc1036Pattern =        "EEEEEEEEE, dd-MMM-yy HH:mm:ss z";    // format for C asctime() date string -- "Sun Nov  6 08:49:37 1994"    private final static String asctimePattern =        "EEE MMM d HH:mm:ss yyyyy";    /**     * Pattern used for old cookies     */    public final static String OLD_COOKIE_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z";    /**     * DateFormat to be used to format dates     */    public final static DateFormat rfc1123Format =        new SimpleDateFormat(RFC1123_PATTERN, LOCALE_US);    /**     * DateFormat to be used to format old netscape cookies     */    public final static DateFormat oldCookieFormat =        new SimpleDateFormat(OLD_COOKIE_PATTERN, LOCALE_US);    public final static DateFormat rfc1036Format =        new SimpleDateFormat(rfc1036Pattern, LOCALE_US);    public final static DateFormat asctimeFormat =        new SimpleDateFormat(asctimePattern, LOCALE_US);    static {        rfc1123Format.setTimeZone(GMT_ZONE);        oldCookieFormat.setTimeZone(GMT_ZONE);        rfc1036Format.setTimeZone(GMT_ZONE);        asctimeFormat.setTimeZone(GMT_ZONE);    }}

 

转载于:https://www.cnblogs.com/zhao1949/p/9876463.html

你可能感兴趣的文章
Eigenvectors and eigenvalues
查看>>
【bfs】noip模拟赛 栅栏迷宫
查看>>
4分钟学会网页样式
查看>>
springboot freeMarker
查看>>
Getting started with Processing 第九章总结
查看>>
eclipse同一个工作空间下分开多个项目
查看>>
windows10 64位下安装oracle 11g和PL/SQL Developer
查看>>
【PHP篇】面向对象基础
查看>>
【BZOJ-2342】双倍回文 Manacher + 并查集
查看>>
RTOS Semaphore Services
查看>>
Bug写作指南
查看>>
跳槽离职的那些事儿?(转)
查看>>
PTAM 编译安装 on MAC(mavericks)
查看>>
使用XmlViewResolver视图解析器
查看>>
AJAX - 向服务器发送请求
查看>>
深入理解子类和父类之间关系
查看>>
帝国时代II 高清版 steam 4.4 字体替换 微软雅黑
查看>>
outlook 配置经验
查看>>
[转]Linux命令的返回值
查看>>
NSTimeZone
查看>>