Skip to main content
Hi,

This is for Unidata 8.2.

For years I thought the following was equivalent: 

ICONV(DTE,'D')
ICONV(DTE,'D2/')
ICONV(DTE,'D4/)

My assumption was that Unidata did not care about the number or the slash and just did an internal date conversion. 

Today I learned that it is not. 

While entering 1/11/11  all return 15717 as does 1/11/2011 as does 11 JAN 2011 as does 11 JAN 11 but entering 11012011 does not.

ICONV(DTE,'D')          returns 15717
ICONV(DTE,'D2/')     returns 19004
ICONV(DTE,'D4/)      returns 15717

Is this a bug or does this jibe with your understanding?

Thanks,

Steve
Hi,

This is for Unidata 8.2.

For years I thought the following was equivalent: 

ICONV(DTE,'D')
ICONV(DTE,'D2/')
ICONV(DTE,'D4/)

My assumption was that Unidata did not care about the number or the slash and just did an internal date conversion. 

Today I learned that it is not. 

While entering 1/11/11  all return 15717 as does 1/11/2011 as does 11 JAN 2011 as does 11 JAN 11 but entering 11012011 does not.

ICONV(DTE,'D')          returns 15717
ICONV(DTE,'D2/')     returns 19004
ICONV(DTE,'D4/)      returns 15717

Is this a bug or does this jibe with your understanding?

Thanks,

Steve
Steve,

If you are still getting ICONV( "01/11/11", "D2/")  to return 19004, then please open a support case with your Rocket U2 Support Provider.

Note I did a quick test, and I am not getting what you are getting:

:CT BP THEDATE
BP:

THEDATE
CRT "ENTER THE DATE":;INPUT ODATE
CRT "D - ":ICONV(ODATE, "D")
CRT "D2/- ":ICONV(ODATE, "D2/")
PRINT "D4/- ":ICONV(ODATE, "D4/")

------
:RUN BP THEDATE
ENTER THE DATE?011111
D - 15717
D2/- 15717
D4/- 15717
:RUN BP THEDATE
ENTER THE DATE?01/11/11
D - 15717
D2/- 15717
D4/- 15717
:RUN BP THEDATE
ENTER THE DATE?01/11/2011
D - 15717
D2/- 15717
D4/- 15717

Hi,

This is for Unidata 8.2.

For years I thought the following was equivalent: 

ICONV(DTE,'D')
ICONV(DTE,'D2/')
ICONV(DTE,'D4/)

My assumption was that Unidata did not care about the number or the slash and just did an internal date conversion. 

Today I learned that it is not. 

While entering 1/11/11  all return 15717 as does 1/11/2011 as does 11 JAN 2011 as does 11 JAN 11 but entering 11012011 does not.

ICONV(DTE,'D')          returns 15717
ICONV(DTE,'D2/')     returns 19004
ICONV(DTE,'D4/)      returns 15717

Is this a bug or does this jibe with your understanding?

Thanks,

Steve
Using @Mike Rajkowski's code and testing on a UV 11.3.3 with NLS active and using the AU locale (so date format is "DD/MM/YYYY") I do get inconsistent results using @Steve Mayo example data
>RUN GDS.BP TEST.DATA
ENTER THE DATE?1/11/11
D - 16011
D2/- 16011
D4/- 16011
>RUN GDS.BP TEST.DATA
ENTER THE DATE?1/11/2011
D - 16011
D2/- 16011
D4/- 16011
>RUN GDS.BP TEST.DATA
ENTER THE DATE?11 JAN 2011
D - 15717
D2/- 15717
D4/- 15717
>RUN GDS.BP TEST.DATA
ENTER THE DATE?01 NOV 2011
D - 16011
D2/- 16011
D4/- 16011
>RUN GDS.BP TEST.DATA
ENTER THE DATE?11 JAN 11
D - 15717
D2/- 15717
D4/- 15717
>RUN GDS.BP TEST.DATA
ENTER THE DATE?01 NOV 11
D - 16011
D2/- 16011
D4/- 16011
>RUN GDS.BP TEST.DATA
ENTER THE DATE?11012011
D - 15717
D2/-
D4/-
>​

So an 8 digit number is not being converted to a date using the 'D', 'D2/' or 'D4/' date format codes​.

However, if you use the 'DI' conversion code it works fine:
>OCONV 11012011 DI
OCONV('11012011','DI') = '15717'

>​

Hi,

This is for Unidata 8.2.

For years I thought the following was equivalent: 

ICONV(DTE,'D')
ICONV(DTE,'D2/')
ICONV(DTE,'D4/)

My assumption was that Unidata did not care about the number or the slash and just did an internal date conversion. 

Today I learned that it is not. 

While entering 1/11/11  all return 15717 as does 1/11/2011 as does 11 JAN 2011 as does 11 JAN 11 but entering 11012011 does not.

ICONV(DTE,'D')          returns 15717
ICONV(DTE,'D2/')     returns 19004
ICONV(DTE,'D4/)      returns 15717

Is this a bug or does this jibe with your understanding?

Thanks,

Steve
Ok, I did a bit more research on this, and UniVerse and D3 do similar things.  When the date conversion is done, and there is no delimiter the empty string is returned.

Note that in my test on UniVerse, I did not use NLS or change the local.

My results is as follows:
> RUN BP THEDATE
ENTER THE DATE?01112011
D - 
D2/- 
D4/- 
>.RUN BP THEDATE
ENTER THE DATE?11012011
D - 
D2/- 
D4/- 
 
I do like the option of using "DI" as mentioned by @Gregor Scott

​​
Hi,

This is for Unidata 8.2.

For years I thought the following was equivalent: 

ICONV(DTE,'D')
ICONV(DTE,'D2/')
ICONV(DTE,'D4/)

My assumption was that Unidata did not care about the number or the slash and just did an internal date conversion. 

Today I learned that it is not. 

While entering 1/11/11  all return 15717 as does 1/11/2011 as does 11 JAN 2011 as does 11 JAN 11 but entering 11012011 does not.

ICONV(DTE,'D')          returns 15717
ICONV(DTE,'D2/')     returns 19004
ICONV(DTE,'D4/)      returns 15717

Is this a bug or does this jibe with your understanding?

Thanks,

Steve
@Mike Rajkowski - did you mean to include the output from your testing runs?
I don't see the results from your testing - just the conversion codes​