Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Locale;
import android.text.format.Time;

public class Main {

    public static String getSysDate() {

        Time t = new Time();
        t.setToNow();
        int year = t.year;
        int month = t.month + 1;
        int day = t.monthDay;

        int hour = t.hour; // 0-23
        int minute = t.minute;
        int second = t.second;

        return String.format("%04d%02d%02d%02d%02d%02d", year, month, day, hour, minute, second,
                Locale.getDefault());
    }
}