Java Date Now getCurrentStrTimeMills()

Here you can find the source of getCurrentStrTimeMills()

Description

get Current Str Time Mills

License

Apache License

Declaration

public static String getCurrentStrTimeMills() 

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 getCurrentStrTimeMills() {
        return getCurrentStrTime("yyyy-MM-dd HH:mm:ss:SSS");
    }/*from  w  w  w.  ja v a  2 s .  c  o  m*/

    public static String getCurrentStrTime() {
        return getCurrentStrTime("yyyy-MM-dd HH:mm:ss");
    }

    public static String getCurrentStrTime(String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        Date date = new Date();
        String currentTime = sdf.format(date);

        return currentTime;
    }
}

Related

  1. getCurrentSecond()
  2. getCurrentString(String pattern)
  3. getCurrentStringDate()
  4. getCurrentStringDate(String pattern)
  5. getCurrentStringDateYMD()
  6. getCurrentTime()
  7. getCurrentTime()
  8. getCurrentTime()
  9. getCurrentTime()