1 17 18 19 package org.apache.catalina.util; 20 21 import java.text.DateFormat ; 22 import java.text.SimpleDateFormat ; 23 import java.util.Locale ; 24 import java.util.TimeZone ; 25 26 34 public class DateTool { 35 36 private static StringManager sm = 37 StringManager.getManager("org.apache.catalina.util"); 38 39 42 public final static Locale LOCALE_US = Locale.US; 43 44 47 public final static TimeZone GMT_ZONE = TimeZone.getTimeZone("GMT"); 48 49 52 public final static String RFC1123_PATTERN = 53 "EEE, dd MMM yyyyy HH:mm:ss z"; 54 55 58 public static final String HTTP_RESPONSE_DATE_HEADER = 59 "EEE, dd MMM yyyy HH:mm:ss zzz"; 60 61 private final static String rfc1036Pattern = 63 "EEEEEEEEE, dd-MMM-yy HH:mm:ss z"; 64 65 private final static String asctimePattern = 67 "EEE MMM d HH:mm:ss yyyyy"; 68 69 72 public final static String OLD_COOKIE_PATTERN = "EEE, dd-MMM-yyyy HH:mm:ss z"; 73 74 77 public final static DateFormat rfc1123Format = 78 new SimpleDateFormat (RFC1123_PATTERN, LOCALE_US); 79 80 83 public final static DateFormat oldCookieFormat = 84 new SimpleDateFormat (OLD_COOKIE_PATTERN, LOCALE_US); 85 86 public final static DateFormat rfc1036Format = 87 new SimpleDateFormat (rfc1036Pattern, LOCALE_US); 88 89 public final static DateFormat asctimeFormat = 90 new SimpleDateFormat (asctimePattern, LOCALE_US); 91 92 static { 93 rfc1123Format.setTimeZone(GMT_ZONE); 94 oldCookieFormat.setTimeZone(GMT_ZONE); 95 rfc1036Format.setTimeZone(GMT_ZONE); 96 asctimeFormat.setTimeZone(GMT_ZONE); 97 } 98 99 } 100 | Popular Tags |