Java OffsetDateTime toRfc1123String(FileTime time)

Here you can find the source of toRfc1123String(FileTime time)

Description

to Rfc String

License

Open Source License

Declaration

static String toRfc1123String(FileTime time) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 Sebastian Stenzel/*from  w w w. j av a  2  s.c om*/
 * This file is licensed under the terms of the MIT license.
 * See the LICENSE.txt file for more info.
 * 
 * Contributors:
 *     Sebastian Stenzel - initial API and implementation
 ******************************************************************************/

import java.nio.file.attribute.FileTime;

import java.time.OffsetDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.time.temporal.Temporal;

public class Main {
    static String toRfc1123String(FileTime time) {
        final Temporal date = OffsetDateTime.ofInstant(time.toInstant(), ZoneOffset.UTC);
        return DateTimeFormatter.RFC_1123_DATE_TIME.format(date);
    }
}

Related

  1. nowAtZone(String offsetId)
  2. parseDate(String raw)
  3. stringifyDate(long timestamp)
  4. timeF(OffsetDateTime time, ZoneId zone)
  5. toCalendar(OffsetDateTime offsetDateTime)