on 07-26-2006 7:39 AM
Hi all,
I have a scenario in which the need arises for checking the date format.The source field has to be checked whether having the format YYYYMMDD.How can I handle this?
Thanks and Regards,
Jishi
Hi Jishi,
I think Jithesh's function should solve your problem. Did it?
cheers,
Prashanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Write a user defined function
where u can use the java code
Format formatter = new SimpleDateFormat("yyyy/MM/dd");
here u can specify the required date format.
so ur input will be a string with the date,
so convert the date string into a Date object and then format the date according to ur need.
Date dtobj = new Date(strgDate); //convert the string into date object.
Format formatter = new SimpleDateFormat("yyyy/MM/dd"); //specify the required format.
formatter.format(dtobj); //format ur date
return dtobj;
cheers
jithesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey,
U can use substring function
and get the date,month and year from the date string
and seperately check whther the given date is not more than 31 or check if month is not more tha 21.
so it will be
String strdate,strmonth;
strdate=substring(datestring,beginposition,endposition);
strmonth=substring(datestring,beginposition,endposition);
then check the conditon using if statement.
cheers
jithesh
Jishi,
This can be done using an UDF.
String inputdate= YYYYMMDD;
int month=Integer.parseInt(inputdate.substring(4,6));
int date=Integer.parseInt(inputdate.substring(6,inputdate.length()));
if((month>=1&&month<=12)&&(date>=1&&date<=31){
return "VALID";
}
else{
return "INVALID";
}
Regards,
Bhavesh
Hi ,
you can check this with standard functions also...
http://help.sap.com/saphelp_nw04/helpdata/en/2c/2d8c4024d26e1de10000000a1550b0/content.htm ...
sekhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jishi,
You can write a user defined function to check the same.
cheers,
Prashanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.