I have a web service in which we pass a date as
string ::
fromDate=2012-11-06 22:16:23.157&toDate=2012-11-06(THIS IS TYPE 1)
22:44:56.367
and
fromDate=2012-11-06&toDate=2012-11-07(THIS IS TYPE 2)
NOW, what i want is when we have “TYPE 1”, then –
List<something> myList=vc.getsomething(FromDate,ToDate);
else{
String newFromDate = fromDate + " " + constant.ZERO_APPEND;
String newToDate = toDate + " " + constant.ZERO_APPEND;
List<something> myList=vc.getsomething(newFromDate,newToDate);
}
how to do this..?? please help..
if you want to check the format, you should use regular expressions in java and check the format using
str.matches("Regex here")(regex in java)or if your format is kind of fixed, you can just check with
str.contains(":")to check for first format