Java Today getToday()

Here you can find the source of getToday()

Description

get Today

License

Open Source License

Return

a String representing today in yyyy-MM-dd format

Declaration

public static String getToday() 

Method Source Code

//package com.java2s;
/* Copyright 2014-2016, hbz. Licensed under the Eclipse Public License 1.0 */

import java.text.SimpleDateFormat;
import java.util.Calendar;

public class Main {
    /**//from w w  w . jav a2  s  .  com
     * @return a String representing today in yyyy-MM-dd format
     */
    public static String getToday() {
        String dateFormat = "yyyy-MM-dd";
        Calendar calender = Calendar.getInstance();
        SimpleDateFormat simpleDate = new SimpleDateFormat(dateFormat);
        return simpleDate.format(calender.getTime());
    }
}

Related

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