Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.Format;
import java.text.SimpleDateFormat;
import java.util.Calendar;

import java.util.Date;

import java.util.TimeZone;

public class Main {
    /**
     * Returns a string suitable for the date for a cookie.
     * 
     * @return a string suitable for the date for a cookie
     */
    public static String createCookieDate() {
        // Wdy, DD-Mon-YYYY HH:MM:SS GMT
        Format f = new SimpleDateFormat("E, dd-MM-yyyy kk:mm:ss");
        Date date = Calendar.getInstance(TimeZone.getTimeZone("GMT")).getTime();
        return f.format(date) + " GMT";
    }
}