Java Today getToday()

Here you can find the source of getToday()

Description

get Today

License

Open Source License

Declaration

public final static String getToday() 

Method Source Code

//package com.java2s;
/**/* w  w w  .j  a v a 2  s . c om*/
 * @copyright Copyright (C) 2014-2015 City of Bloomington, Indiana. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.txt
 * @author W. Sibo <sibow@bloomington.in.gov>
 */

import java.util.*;

public class Main {
    public final static String getToday() {

        String day = "", month = "", year = "";
        Calendar current_cal = Calendar.getInstance();
        int mm = (current_cal.get(Calendar.MONTH) + 1);
        int dd = current_cal.get(Calendar.DATE);
        year = "" + current_cal.get(Calendar.YEAR);
        if (mm < 10)
            month = "0";
        month += mm;
        if (dd < 10)
            day = "0";
        day += dd;
        return month + "/" + day + "/" + year;
    }
}

Related

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