package de.jeha.s3srv.common;

import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.joda.time.tz.FixedDateTimeZone;

import java.util.Date;
import java.util.Locale;

/**
 * @author jenshadlich@googlemail.com
 */
public class RFC822Date {
    private static final DateTimeZone GMT = new FixedDateTimeZone("GMT", "GMT", 0, 0);

    private static final DateTimeFormatter DATE_FORMAT =
            DateTimeFormat.forPattern("EEE, dd MMM yyyy HH:mm:ss 'GMT'")
                    .withLocale(Locale.US)
                    .withZone(GMT);

    public static Date parse(String date) {
        return new Date(DATE_FORMAT.parseMillis(date));
    }

    public static String format(Date date) {
        return DATE_FORMAT.print(date.getTime());
    }

}

@@ -459,28 +459,16 @@
 FORMAT =
-%0A           
  DateTim
@@ -529,32 +529,24 @@
             
-   
-     
 .withLocale(
@@ -564,32 +564,24 @@
             
-        
 .withZone(GM
@@ -581,24 +581,123 @@
 Zone(GMT);%0A%0A
+    /**%0A     * @param dateString parse the given string%0A     * @return Date representation%0A     */%0A
     public s
@@ -720,24 +720,30 @@
 (String date
+String
 ) %7B%0A        
@@ -786,16 +786,22 @@
 lis(date
+String
 ));%0A    
@@ -803,16 +803,115 @@
 %0A    %7D%0A%0A
+    /**%0A     * @param date the date%0A     * @return string representation of the given date%0A     */%0A
     publ

update documentation