Java Date Now getCurrentTime(String format)

Here you can find the source of getCurrentTime(String format)

Description

get Current Time

License

Apache License

Declaration

public static String getCurrentTime(String format) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public static String getCurrentTime(String format) {
        long time = System.currentTimeMillis();
        SimpleDateFormat dayTime = new SimpleDateFormat(format);
        String currentTime = dayTime.format(new Date(time));
        return currentTime;
    }//  ww  w. j  av  a  2  s  .  c  o m
}

Related

  1. getCurrentTime()
  2. getCurrentTime(Date _d)
  3. getCurrentTime(long delay, long interval)
  4. getCurrentTime(String format)
  5. getCurrentTime(String format)
  6. getCurrentTime(String format)
  7. getCurrentTime(String format)
  8. getCurrentTime(String formatter)
  9. getCurrentTime(String pattern)