Java Long Number to Date formatDateHeader(long value)

Here you can find the source of formatDateHeader(long value)

Description

format Date Header

License

Apache License

Declaration

public static String formatDateHeader(long value) 

Method Source Code

//package com.java2s;
/*//from w  w  w  . j a  v  a  2  s .co m
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.Locale;
import java.util.TimeZone;

public class Main {
    private static final String HTTP_RESPONSE_DATE_HEADER = "EEE, dd MMM yyyy HH:mm:ss zzz";
    private static final TimeZone GMT = TimeZone.getTimeZone("GMT");

    public static String formatDateHeader(long value) {
        SimpleDateFormat format = new SimpleDateFormat(HTTP_RESPONSE_DATE_HEADER, Locale.US);
        format.setTimeZone(GMT);
        return format.format(new Date(value));
    }
}

Related

  1. formatDate2DateStr(long date)
  2. formatDateForLog(long dateTs)
  3. formatDateHeader(final long date)
  4. formatDateHeader(final long date)
  5. formatDateHeader(long millis)
  6. formatDateISO(long millis)
  7. formatDateTime(long d)
  8. formatDateTime(long d)
  9. formatDateTime(long date)