Java Date Now getCurrentDateTime(String format)

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

Description

get Current Date Time

License

LGPL

Declaration

public static String getCurrentDateTime(String format) 

Method Source Code

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

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String getCurrentDateTime(String format) {
        return millisToDateTime(System.currentTimeMillis(), format);
    }//from  w ww . ja va  2  s  . c  om

    public static String millisToDateTime(long millis, String format) {
        SimpleDateFormat dateFormat = new SimpleDateFormat(format);
        return dateFormat.format(new Date(millis));
    }
}

Related

  1. getCurrentDateTime()
  2. getCurrentDateTime()
  3. getCurrentDateTime()
  4. getCurrentDateTime()
  5. getCurrentDateTime(String dateFormat)
  6. getCurrentDateTimeForShow()
  7. getCurrentDateTimeISO8601()
  8. getCurrentDateTimeObj(String dateTime, String format)
  9. getCurrentDateTimeString()