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.Calendar;

import java.util.Locale;

import java.util.TimeZone;

public class Main {
    private static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault());

    private static String getTime() {

        format.setLenient(false);
        format.setTimeZone(TimeZone.getTimeZone("GMT+8"));
        return format.format(Calendar.getInstance().getTime());
    }
}