Well i am trying to define a date and see the difference with recent date in seconds. Below is the code i did inside onCreate method of activity:
txtNowTime = (TextView)findViewById(R.id.textViewNow);
SimpleDateFormat formata = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
String currentDateandTime = formata.format(new Date());
@SuppressWarnings("deprecation")
Date oldd = new Date("07/18/2014 11:12:13");
String olddt_frmt = formata.format(oldd);
long diff =0;
try {
Date d_recent = formata.parse("currentDateandTime");
diff = d_recent.getTime() - oldd.getTime();
} catch (ParseException ex) {
ex.printStackTrace(); }
txtNowTime.setText(String.valueOf(diff));
But its not showing any result. :-(