Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Locale;
import android.annotation.SuppressLint;

public class Main {
    @SuppressLint("SimpleDateFormat")
    public static String dateToString(long date) {
        String format, language;
        language = Locale.getDefault().getISO3Language();
        if (language.equals("spa")) {
            format = "dd/MM/yyyy HH:mm:ss";
        } else {
            format = "EEE, MMM d, yyyy HH:mm:ss";
        }
        SimpleDateFormat sdf = new java.text.SimpleDateFormat(format);
        String fecha = sdf.format(date * 1000);
        return fecha;
    }
}