Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.joda.time.DateTime;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Locale;

public class Main {
    public static final SimpleDateFormat RFC822Formatter = new SimpleDateFormat("EEE, dd MMMM yyyy HH:mm:ss Z",
            Locale.US);

    public static DateTime format(String date) {
        try {
            return new DateTime(RFC822Formatter.parse(date));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}