Thursday, December 12, 2013

Manually Convert Date To String In Oaf.

If the input date with time format (dd-mm-yyyy hh:mm:ss),
then use the below method to make the date in a string format (dd-mmm-yyyy).

From this converted String date we can convert jbo date also by using castToJBODate(Check my previous post).


    public static String formatedDate(String date)
    {  
        String[] temp2 =  date.split("-");
       
        String monthTmp="";
       
        String[] arr = {"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"};
        String[] arr2 = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
       
        for (int i = 0 ; i<arr.length;i++ )
        {
            for (int j =0 ;j<temp2.length ;j++ )
            {
                if(arr[i].equalsIgnoreCase(temp2[j]))
                {
                    monthTmp = arr2[i];
                }
            }
        }
       
        return temp2[2]+"-"+monthTmp+"-"+temp2[0];
    }

No comments:

Post a Comment