Java Time Now currentTime()

Here you can find the source of currentTime()

Description

current Time

License

Apache License

Declaration

public static String currentTime() 

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 currentTime() {
        return formatDate(new Date(), "yyyyMMddhhmmssSSS");
    }//from   www  .  j  a  va 2s  . co  m

    public static String formatDate(Date date) {
        if (date == null) {
            return "";
        }
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return dateFormat.format(date);
    }

    public static String formatDate(Date date, String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(date);
    }
}

Related

  1. currentTime()
  2. currentTime()
  3. currentTime()
  4. currentTime()
  5. currentTime()
  6. currentTime()
  7. currentTimedDate()
  8. currentTimeMillis()
  9. currentTimePath(String basePath)