Skip to Content
avatar image
Former Member

need UDF for comparing date

HI ,

I have requirement for which i need to create target node on basis of below date fields condition

AEDTM = System date and BEGDA <= system date then create

or

BEGDA = System date and AEDTM <= system date

how can I achieve this

Tx

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 03, 2015 at 03:52 PM

    Hello Ramesh,

    You can use date function

    AEDTM = System date - use compare dates function

    BEGDA <= system date then create- use datebefore function.

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 04:09 PM

    Hi,

    Check this function:

    
    public static String compareDates(String startDate,String EndDate) 
    { 
          String difference=""; 
    try 
    { 
           String pattern = "yyyy-MM-dd"; 
           long  diff; 
           final long  MilliSecondsInADay=1000 * 60 * 60 * 24 ; 
           java.text.SimpleDateFormat Dateformat = new java.text.SimpleDateFormat(pattern); 
           java.util.Date endDate= Dateformat.parse(EndDate); 
           java.util.Date StartDate= Dateformat.parse(startDate); 
           diff=(endDate.getTime()-StartDate.getTime())/MilliSecondsInADay; 
           if(diff<0) 
           { 
                 diff=-diff; 
           } 
           difference=""+diff; 
    } 
    catch(java.text.ParseException e) 
    { 
           e.printStackTrace(); 
    } 
    return difference; 
    } 
    

    Regards

    Marcelo Macedo

    Add comment
    10|10000 characters needed characters exceeded