Java Now now()

Here you can find the source of now()

Description

now

License

Open Source License

Declaration

public static Date now() 

Method Source Code


//package com.java2s;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;

public class Main {
    public static String now(String format) {
        SimpleDateFormat f = new SimpleDateFormat(format);
        return f.format(new Date());
    }/*  w  w w .  j av  a2  s.  c  om*/

    public static Date now() {
        return new Date();
    }

    public static String format(Date d, String format) {
        return format(d, format, Locale.getDefault());
    }

    public static String format(Date d, String format, Locale locale) {
        if (d == null)
            return "";
        DateFormat df = new SimpleDateFormat(format, locale);
        return df.format(d);
    }
}

Related

  1. now()
  2. now()
  3. now()
  4. now()
  5. now()
  6. now()
  7. now()
  8. now()
  9. Now()