Java Long Number to Time getExpires(long maxAge)

Here you can find the source of getExpires(long maxAge)

Description

get Expires

License

MIT License

Declaration

public static String getExpires(long maxAge) 

Method Source Code

//package com.java2s;
/*/*  ww w . ja  va2  s.  co  m*/
 * Protorabbit
 *
 * Copyright (c) 2009 Greg Murray (protorabbit.org)
 * 
 * Licensed under the MIT License:
 * 
 *  http://www.opensource.org/licenses/mit-license.php
 *
 */

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

public class Main {
    private static SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss  z");

    public static String getExpires(long maxAge) {
        long created = System.currentTimeMillis();
        Date expiredate = new Date(created + (maxAge * 1000));
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(expiredate);
    }
}

Related

  1. getDT(long mills)
  2. getDuration(long time)
  3. getElapsedTime(long start, long end)
  4. getElapsedTime(long startTime, long finishTime)
  5. getElapsedTimeSpecificationDescription(long sizeInBytes)
  6. getHMSFromMills(long millSec)
  7. getOldCookieDate(long time)
  8. getReadableDate(long longTime)
  9. getServerTime(long offset)