Java Now now()

Here you can find the source of now()

Description

now

License

Open Source License

Declaration

public static long now() 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    public static long now() {
        return System.currentTimeMillis();
    }//from w w w .  j a v  a  2  s.  co m

    public static String now(String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(now());
    }

    public static String format(long t, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(t);
    }

    public static String format(Calendar calendar, String format) {
        return format(calendar.getTimeInMillis(), format);
    }

    public static String format(Date date, String format) {
        return format(date.getTime(), format);
    }
}

Related

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