Find the date is Current date or not – Android

SimpleDateFormat sdf = new SimpleDateFormat(

“dd-MM-yyyy HH:mm:ss”);

Date date = sdf.parse(date_string);

Calendar calendar = Calendar.getInstance();


calendar.set(calendar.get(calendar.YEAR), calendar.get(calendar.MONTH),

calendar.get(calendar.DATE), calendar.get(calendar.HOUR),

calendar.get(calendar.MINUTE), calendar.get(calendar.SECOND));

long startTime = calendar.getTimeInMillis();

Boolean isCurrnetDate =  DateUtils.isToday(startTime);


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s