cancel
Showing results for 
Search instead for 
Did you mean: 

how to send month as string to date

Former Member
0 Kudos

Hi

my input comes as

month year.( oct 2008 or Nov 2008 etc )

The target field is a Date.

I have tried using Date trans but it doesnt accept strings.

so is there a way send the incoming field without changing target data to string?

Regards,

Venkat.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

If you get value Oct 2008, what will be the date field value is it (01-Oct-2008)?

regards

Unni

Former Member
0 Kudos

It should be either Oct-2008 or Oct/2008..

I dont need to add anything.

Regards,

Venkat.

Former Member
0 Kudos

I am assuming you can bring in month & year in 2 seperate variable to UDF named as below

String strMonth & String strYear

java.text.DateFormat df = new SimpleDateFormat("dd/MON/yyyy");

java.util.Date today = df.parse("01""/"strMonth"/"strYear);

Now you have the date object & you can convert the way you need. Please note I am initializing the object to start of the month always.

Regards

Unni

Former Member
0 Kudos

Hi,

Use Date transformation funtion in mapping

To accept the string month ,You can use source format as --- dd-MMM-yyyy or dd/MMM/yyyy

And the target format as you required format Ex: dd/mm/yyyy or dd-mm-yyyy

REgards

Seshagiri

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

This is possible using Date Trans function.

src-->TransformDate->tgt

Format of Source Date - MMM yyyyy

Format of Target Date - MMM/yyyy