Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;

public class Main {
    public static String getFormatDateFromAmazon(String amazonDate) {
        String month = null;
        String date = null;
        String year = null;
        if (TextUtils.isEmpty(amazonDate))
            return "";
        String[] format_1 = amazonDate.split(",");
        String[] month_date = format_1[0].split(" ");
        month = month_date[0];
        date = month_date[1];
        if (format_1[1].startsWith(" ")) {
            format_1[1] = format_1[1].substring(1, format_1[1].length());
        }
        String[] year_plus = format_1[1].split(" ");
        year = year_plus[0];
        if (TextUtils.equals(month, "Jan"))
            month = "1";
        else if (TextUtils.equals(month, "Feb"))
            month = "2";
        else if (TextUtils.equals(month, "Mar"))
            month = "3";
        else if (TextUtils.equals(month, "Apr"))
            month = "4";
        else if (TextUtils.equals(month, "May"))
            month = "5";
        else if (TextUtils.equals(month, "Jun"))
            month = "6";
        else if (TextUtils.equals(month, "Jul"))
            month = "7";
        else if (TextUtils.equals(month, "Aug"))
            month = "8";
        else if (TextUtils.equals(month, "Sep"))
            month = "9";
        else if (TextUtils.equals(month, "Oct"))
            month = "10";
        else if (TextUtils.equals(month, "Nov"))
            month = "11";
        else if (TextUtils.equals(month, "Dev"))
            month = "12";
        return month + "/" + date + "/" + year;
    }
}