Skip to Content
avatar image
Former Member

UDF for 07-OCT-17 to 20171007

Hi,

Please help with the UDF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    Oct 26, 2017 at 02:53 PM

    My bad,Please change the output format to yyyyMMdd

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 26, 2017 at 01:12 PM

    You can achieve this using standard date transformation like below

    Paste the formats for input as dd-MMM-yy and output as

    yyyymmdd

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 26, 2017 at 12:54 PM

    Hi Sai!

    Here is an example of java method for date format conversion:

    public static String convertDate(String srcDateString, String srcDateFormat, String dstDateFormat) {
    String dstDateString = "";
    
    if (srcDateFormat == null || srcDateFormat.trim().isEmpty() || dstDateFormat == null || dstDateFormat.trim().isEmpty())
    return dstDateString;
    
    SimpleDateFormat srcFormatter = new SimpleDateFormat(srcDateFormat);
    Date srcDate = null;
    
    if (srcDateString == null || srcDateString.trim().isEmpty())
    srcDate = new Date();
    else
    try {
    srcDate = srcFormatter.parse(srcDateString);
    } catch (ParseException e) {
    return dstDateString;
    }
    
    SimpleDateFormat dstFormatter = new SimpleDateFormat(dstDateFormat);
    dstDateString = dstFormatter.format(srcDate);
    
    return dstDateString;
    }

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded