Java Date Now getCurrentDate()

Here you can find the source of getCurrentDate()

Description

get Current Date

License

Open Source License

Declaration

public static int[] getCurrentDate() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static int[] getCurrentDate() {
        int[] dateBundle = new int[3];
        String[] temp = getDataTime("yyyy-MM-dd").split("-");

        for (int i = 0; i < 3; i++) {
            try {
                dateBundle[i] = Integer.parseInt(temp[i]);
            } catch (Exception e) {
                dateBundle[i] = 0;/*from w w  w. ja va2s .c  o  m*/
            }
        }
        return dateBundle;
    }

    public static String getDataTime(String format) {
        SimpleDateFormat df = new SimpleDateFormat(format);
        return df.format(new Date());
    }
}

Related

  1. getCurrentCalendar()
  2. getCurrentCompactTime()
  3. getCurrentDataInFormat(String pattern)
  4. getCurrentDataTimePrettyFilesystem()
  5. getCurrentDate()
  6. getCurrentDate()
  7. getCurrentDate()
  8. getCurrentDate()
  9. getCurrentDate()