i have a booking form that requires a user to input their details alongside a date. the user cannot submit a date that is within 24 hours. a booking must be made after 24 hours.
how can i implement this?. i have obtained the current date and time.
so if the current date and time is 19062012 1324 the booking cannot be made until 20062012 1324
what i tried to do is this:
long mdates = (long) (Long.parseLong(date.getText().toString()));
long mprefered= (long) (Long.parseLong(date2.getText().toString()));
long sub = mprefered - mdates;
if (preferedDateEditText.getText().toString() != null
&& !preferedDateEditText.getText().toString()
.equalsIgnoreCase("") && sub>100000000) {
emailBody += "Prefered date & Time:"
+ preferedDateEditText.getText().toString().trim()
+ "\n sub="+sub;
} else {
errorMessage += "A booking cannot be made within 24 hours.";
}
this works however if the prefered date is 01072012 1324 then it wont accept as being 24 hours in advance any help would be appreciated