Is there something like TimeSpan in android development?
android
Solution
public long addSeconds(long dt,int sec) //method to add seconds in time
{
Date Dt = new Date(dt);
Calendar cal = new GregorianCalendar();
SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy HH:mm:ss");
sdf.setCalendar(cal);
cal.setTimeInMillis(Dt.getTime());
cal.add(Calendar.SECOND, sec);
return cal.getTime().getTime();
}
pass date and time in sec, it will return modified time...
Problem
I need to know if there is something like a timespan in android development? in C# there is something like and I like to use it in two ways: - generate a timespan and then add e.g. minutes and then display the whole span - generate the timespan between two DateTime (what is the equivalent for DateTime in android?)