Java Date Now getCurrentYMDDate()

Here you can find the source of getCurrentYMDDate()

Description

get Current YMD Date

License

Open Source License

Declaration

public static String getCurrentYMDDate() 

Method Source Code


//package com.java2s;
import java.text.*;
import java.util.*;

public class Main {
    private static String CurrentTime;

    public static String getCurrentYMDDate() {
        Calendar cal = Calendar.getInstance();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        CurrentTime = formatter.format(cal.getTime());
        return CurrentTime;
    }/* w w w. ja v a 2 s. co  m*/

    public static int getTime(String sDateTime, String eDateTime) throws ParseException {
        SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd");
        java.util.Date ssDateTime = myFormatter.parse(sDateTime);
        java.util.Date eeDateTime = myFormatter.parse(eDateTime);
        long l = (eeDateTime.getTime() - ssDateTime.getTime());
        long day = l / (24 * 60 * 60 * 1000);
        return (int) day;
    }
}

Related

  1. getCurrentWeekDay(Date date, int day)
  2. getCurrentWeekDays()
  3. getCurrentWeekFirst()
  4. getCurrentYear()
  5. getCurrentYearBegDate(Date date)
  6. getCurrentZeroTime()
  7. getDayToMonthEnd(boolean iscurrentdate)
  8. getNowDate()
  9. getNowDate()