on 09-11-2008 8:10 AM
Hi,
my scenario is i am passing the variable which holds the current date in this format yyyy/dd/mm as argument in userdefined function and i am checking for a codition if the condition is not satisfied then in else part it need to print the
arugument date in yy/mm format..
plz help by providing the code for getting the date format like as mentioned above..
Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
U can do this with simple UDF
Assume a as the current date in format yyyy/dd/mm
public String check_condition(String a,Container container)
{
String b;
if(condition)
{
//steps to be performed
}
else
{
b = a.substring(2,4) + "/" + a.substring(8,10);
return b;
}
}
Edited by: malini balasubramaniam on Sep 11, 2008 9:40 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
couldn't you return the boolean value of your udf to a standard if-function.
UDF -> if true
then: currentDate
else: currentDate -> Transformation(yyyy/dd/mm, yy/mm)
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can customize the UDF..This UDF i wrote to check a condition....
the code is input value a
for(i=0;i<a.length;i++)
{
if(a.equals("A"))
{
result.addValue("Valid Value");
}
else
{
result.addValue("Not a Valid Value");
}
}
:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI
the UDF
java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f
= new java.text.SimpleDateFormat("yyyy-dd-MM");
return f.format(d) ;
else ......
yy/mm format..
Regard's
Chetan Ahuja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
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.