Example usage for io.netty.handler.codec DateFormatter format

List of usage examples for io.netty.handler.codec DateFormatter format

Introduction

In this page you can find the example usage for io.netty.handler.codec DateFormatter format.

Prototype

public static String format(Date date) 

Source Link

Document

Format a Date into RFC1123 format

Usage

From source file:com.linecorp.armeria.common.StringValueConverter.java

License:Apache License

@Nullable
@Override// ww  w . j  a  v  a2  s  .  c  o m
public String convertObject(@Nullable Object value) {
    if (value == null) {
        return null;
    }

    if (value instanceof Date) {
        return DateFormatter.format((Date) value);
    }

    if (value instanceof Calendar) {
        return DateFormatter.format(((Calendar) value).getTime());
    }

    if (value instanceof Instant) {
        return DateFormatter.format(new Date(((Instant) value).toEpochMilli()));
    }

    return value.toString();
}

From source file:com.linecorp.armeria.common.StringValueConverter.java

License:Apache License

@Override
public String convertTimeMillis(long value) {
    return DateFormatter.format(new Date(value));
}

From source file:com.linecorp.armeria.server.file.HttpFileServiceTest.java

License:Apache License

private static String httpDate(Date date) {
    return DateFormatter.format(date);
}