Java Now now(String s, Date date)

Here you can find the source of now(String s, Date date)

Description

now

License

Open Source License

Declaration

public static String now(String s, Date date) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static String now(String s) {
        SimpleDateFormat simpledateformat = new SimpleDateFormat(s);
        Date date = new Date();
        GregorianCalendar gregoriancalendar = new GregorianCalendar();
        gregoriancalendar.setTime(date);
        Date date1 = gregoriancalendar.getTime();
        String s1 = simpledateformat.format(date1);
        return s1;
    }//from   w  ww .j  a  va  2 s. c o m

    public static String now(String s, Date date) {
        SimpleDateFormat simpledateformat = new SimpleDateFormat(s);
        String s1 = simpledateformat.format(date);
        return s1;
    }

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

Related

  1. now(String dateFormat)
  2. now(String dateFormat)
  3. now(String dateFormat)
  4. now(String formatStr)
  5. now(String pattern)
  6. now_TimeZone_BY()
  7. nowAs14CharString()
  8. nowAsAnsiDate()
  9. nowAsString()