Here you can find the source of rfc1123Date(Date d)
Parameter | Description |
---|---|
d | a parameter |
public static final String rfc1123Date(Date d)
//package com.java2s; /**/*from ww w. j a va2 s .c o m*/ * Copyright (C) 2011 University of Washington * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ import java.text.SimpleDateFormat; import java.util.Date; import java.util.TimeZone; public class Main { /** * Date format pattern used to parse HTTP date headers in RFC 1123 format. * copied from apache.commons.lang.DateUtils */ private static final String PATTERN_RFC1123 = "EEE, dd MMM yyyy HH:mm:ss zzz"; /** * Return the RFC1123 string representation of a date. * * @param d * @return */ public static final String rfc1123Date(Date d) { if (d == null) return null; // SDF is not thread-safe SimpleDateFormat asGMTrfc1123 = new SimpleDateFormat( PATTERN_RFC1123); // with // time // zone asGMTrfc1123.setTimeZone(TimeZone.getTimeZone("GMT")); return asGMTrfc1123.format(d); } }