Java Today getToDay(boolean withTime)

Here you can find the source of getToDay(boolean withTime)

Description

get To Day

License

Open Source License

Declaration

public static String getToDay(boolean withTime) 

Method Source Code


//package com.java2s;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static String getToDay(boolean withTime) {

        String formatStr = "yyyy-MM-dd";
        if (withTime) {
            formatStr += " HH:mm:ss";
        }// ww  w . j  a  v a 2s. c o m
        SimpleDateFormat datef = new SimpleDateFormat(formatStr);
        return datef.format(new Date());
    }
}

Related

  1. getToday()
  2. getToday()
  3. getToday()
  4. getToday()
  5. getToday(boolean ceOrTw, String deli)
  6. getToday(int hour, int minute, int second)
  7. getToday(String datePattern)
  8. getToday(String format)
  9. getToday(String formatString)