get Today's date in long value - Android java.util

Android examples for java.util:Day

Description

get Today's date in long value

Demo Code

import android.text.TextUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;

public class Main{


    public static long getToday() {
        Calendar cal = Calendar.getInstance();
        String curDate = convertDate2Str(cal.getTime(), dateFormatYMD);
        curDate = curDate.replace("-", "");
        return Long.parseLong(curDate);
    }//from   w w w  .j a va2s  .co  m

}

Related Tutorials