Skip to Content

I have seen in many Re: Changing the date format where month is a string where people ask about several Re: Regarding converting date fucntion(UDF) and in most of the cases people have suggested to go for UDF to get the desired date format. I hope this blog will be very useful for beginners. Here in this blog I will show few date formats conversions which are possible via standard DateTrans function.                                                                            

Case 1:

How to get the “Month Name” from given Date by using DateTrans function.

Let’s say we have incoming date as 2009/02/13 and we want to get the desired output as 2009-FEB-13.

To get the above result you don’t need to write any UDF, it is simply possible with standard DateTrans function. Open the DateTrans function and double click and then enter yyyy/MM/dd in the “Format of Source Date” and enter  yyyy-MMM-dd in the “Target Format” as shown in below picture.
Here is the results from display Queue. 

Case 2:

How to get the “Date” from give “Year and Days” by using DateTrans function.

Let’s say you have your source date in the from of year & days only i.e. yyddd and you want to convert it into yyyy-MM-dd or any other format.

Open the DateTrans function and then enter yyddd in the “Format of Source Date” and enter  yyyy-MM-dd in the “Target Format”. You can chose any other target format as per your need.  

The result after mapping are as shown below.


Case 3:

How to get time stamp with mili seconds.


Case 4: 

How to get “Week Number” from given date Or how to get the “Date” from given Year and Week.

Just do exactly same as shown in the below picture.


Case 5:

Calculate Date in future or past.

For this, we have to use the UDF as shown below. You just need to map a constant value to this UDF to calculate the future or past date.

UDF Picture:


UDF Code:


 Mapping & Test Results:

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

    1. Former Member Post author
      Well not the whole blog but some part of it says same thing (Exmp 1). In my opinion If we  have something new then I think there is no harm to learn it. 🙂


  1. Former Member
    Indeed its a helpful blog but I dont think output of point 5 will be correct in your example…just run it with input (1999/03/01) and the reason being you can operate arithematic functions on date as it has to follow calender 🙂 .

    Actually, we will have to use GregorianCalendar java class to achieve that kind of requirement.

    Something like this will help:
    public String addDate(String dt, int addd, Container container) throws StreamTransformationException{
         Date dat = new SimpleDateFormat(“yyyyMMdd”).parse(dt);
         Calendar cal = new GregorianCalendar();
         cal.add(Calendar.DAY_OF_MONTH, + addd);
         Date bar = cal.getTime();
         String expDate = new SimpleDateFormat(“yyyyMMdd”).format(bar);
    return (expDate);
    catch(Exception ex)
         return (dt);



Leave a Reply