Date Conversion
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
Date Conversion
Iconv(LinkName.DateColumnName, "DYMD[4,2,2]")
The following code example returns the date in this format: 2003-10-01
How do I modify this to return it in this format: 20031001?
The following code example returns the date in this format: 2003-10-01
How do I modify this to return it in this format: 20031001?
You could use:
I believe it always wants to add a delimiter to the date. This uses a Transform to strip out all non-numeric characters.
Code: Select all
DIGITS(Iconv(LinkName.DateColumnName, "DYMD[4,2,2]"))
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
The dashes are still there. How do I get rid of the dashes? thank for your help!!!chulett wrote:You could use:
I believe it always wants to add a delimiter to the date. This uses a Transform to strip out all non-numeric characters.Code: Select all
DIGITS(Iconv(LinkName.DateColumnName, "DYMD[4,2,2]"))
OCONV formats dates from the internal integer value, not ICONV which tries to recognize dates and turn them into the internal integer value.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
My Oconv returns date like this 2004 08 20
Then this should work fine too:
Trim(Oconv(LinkName.DateColumnName, "DYMD[4,2,2]") , Space(1), "A")
But the question is: what is your input value look like?
Oconv input shoud be integer.
Then this should work fine too:
Trim(Oconv(LinkName.DateColumnName, "DYMD[4,2,2]") , Space(1), "A")
But the question is: what is your input value look like?
Oconv input shoud be integer.
Last edited by leomauer on Fri Aug 20, 2004 11:47 am, edited 1 time in total.
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
What does this "A" mean? This changed the format of the numbers.leomauer wrote:My Oconv returns date like this 2004 08 20
Then this should work fine too:
Trim(Oconv(LinkName.DateColumnName, "DYMD[4,2,2]") , Space(1), "A")
But the question is: what is your input value look like?
Oconv input shoud be integer.
Trim (string,character [ ,option] )
option specifies the type of trim operation and can be one of the following:
L Removes leading occurrences of character.
T Removes trailing occurrences of character.
B Removes leading and trailing occurrences of character.
R Removes leading and trailing occurrences of character, and reduces multiple occurrences to a single occurrence.
A Removes all occurrences of character.
F Removes leading spaces and tabs
E Removes trailing spaces and tabs
D Removes leading and trailing spaces and tabs, and reduces multiple spaces and tabs to single ones.
If option is not specified or is a null value, R is assumed
option specifies the type of trim operation and can be one of the following:
L Removes leading occurrences of character.
T Removes trailing occurrences of character.
B Removes leading and trailing occurrences of character.
R Removes leading and trailing occurrences of character, and reduces multiple occurrences to a single occurrence.
A Removes all occurrences of character.
F Removes leading spaces and tabs
E Removes trailing spaces and tabs
D Removes leading and trailing spaces and tabs, and reduces multiple spaces and tabs to single ones.
If option is not specified or is a null value, R is assumed
I'm a little confused as well. This seems to match your desired output format and would (usually) mean no conversion was required. So, what are we missing?phillip.small wrote:The input is coming from character field like this: 20041030
For what it's worth, DIGITS is a Built-In Transform that simplifies the call to OConv to strip the non-numerics:
Code: Select all
Oconv(%Arg1%, "MCN")
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 29
- Joined: Mon Aug 16, 2004 8:12 am
The output came out like this: 6811-01-06chulett wrote:I'm a little confused as well. This seems to match your desired output format and would (usually) mean no conversion was required. So, what are we missing?phillip.small wrote:The input is coming from character field like this: 20041030
For what it's worth, DIGITS is a Built-In Transform that simplifies the call to OConv to strip the non-numerics:
No clue if it was there in 5.x but I would think it would be.Code: Select all
Oconv(%Arg1%, "MCN")
The input data type is a character and I am converting it to a date column in this format (YYYYMMDD). However, the OCONV function still put the dashes in the output. I do not want the dashes in the table. That is what I am trying to do. Also the DIGITS function output looks like this: 9811-06-11) something like that. They are screwing up the years. What to do?