Java Time Now getNow(String format)

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

Description

get Now

License

Apache License

Declaration

public static String getNow(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 getNow(String format) {
        return dateToString(new Date(), format);
    }//from   www .j  a v  a2 s.  c  o  m

    public static String dateToString(Date date, String pattern) {
        if (date == null)
            return "";
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        String returnValue = "";
        returnValue = sdf.format(date);

        return returnValue;
    }
}

Related

  1. getNow()
  2. getNow()
  3. getNow()
  4. getNow(boolean ifdatetime)
  5. getNow(final String format)
  6. getNowAsNICSDate()
  7. getNowAsString()
  8. getNowDateTime()
  9. getNowDateTime()