Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

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

import java.util.Date;

import android.annotation.SuppressLint;

public class Main {

    @SuppressLint("SimpleDateFormat")
    public static String getTimes(String times) {
        String time = "";
        try {
            Date epoch = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").parse(times.toString().substring(8, 10) + "/"
                    + times.toString().substring(5, 7) + "/" + times.toString().substring(0, 4) + " 01:00:00");
            time = epoch.getTime() / 1000 + "";
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return time;
    }
}