Hi ,
I am getting the data from sequential file,in that the data for the date column is in the format of dd-mon-yyyy(Ex 29-sep-07).
I need to extract month number and month name from it .
fro extracting date and year I useed left() ,Right() . How to get the substring of thedate field.
Date conversion
Moderators: chulett, rschirm, roy
Hi Arndw,ArndW wrote:In a transform stage you can use the derivation "In.DateColumn[4,3]" to get "sep" from "29-sep-07" ...
I used the derivation as "DSLink17.CALL_DATE(4,3)" I got the output as DSL. (DSLink is the name of the input link and the call_date is the name of the column)
I used the derivation as "In.DSLink.Call_date[4,3]" I got the output as In.
Can you please lookinto this....
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Change the data type of this field in the Sequential File stage from Date to VarChar(10) or Char(10). You can then extract the day number and month name using Field() function (especially if the day number may contain one or two digits) or substring (if the day number always contains two digits). Convert month name to month number using something like Index() function searching a string containing all twelve month names. For example:
Code: Select all
(Index("JanFebMarAprMayJunJulAugSepOctNovDec",svMonthName,1)+2)/3
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.