Java Date Now getCurrentTime()

Here you can find the source of getCurrentTime()

Description

get Current Time

License

Open Source License

Declaration

public static String getCurrentTime() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class Main {
    private static Date _currentDate;
    private static DateFormat _dateFormat;

    public static String getCurrentTime() {
        if (_currentDate != null) {
            _currentDate.setTime(System.currentTimeMillis());
        } else {//from  w  ww. j  ava 2 s.  com
            _currentDate = new Date();
        }

        if (_dateFormat == null) {
            _dateFormat = new SimpleDateFormat("MMM-dd-yyyy__hh-mm-ssa");
        }

        return _dateFormat.format(_currentDate);
    }
}

Related

  1. getCurrentTime()
  2. getCurrentTime()
  3. getCurrentTime()
  4. getCurrentTime()
  5. getCurrentTime()
  6. getCurrentTime()
  7. getCurrentTime()
  8. getCurrentTime()
  9. getCurrentTime()