D3 and mvBase

 View Only
Expand all | Collapse all

European Date format

  • 1.  European Date format

    Posted 10-12-2022 07:50

    Hi all

    I reside in the UK and for our "sins" we still honor the European data format of DD/MM/YYYY.


    There is a conversion code which 'e'  which according to the D3 manual states:

    e

    Uses european date format regardless of current system default setting


    This is great, however, I discovered something rather disturbing and am wondering whether anyone (this side of the Atlantic) can see (a) if I'm doing something wrong OR (b) has uncovered this.

    BTW - I am aware of the set-date-eur option in a coldstart - which (in my case) I have not opted to have.

    See this code:

    *My_Date = '30/09/2022'
    *crt My_Date
    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/E')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/E')
    crt d
    crt ' and Done!'

    The results are as follows:

    19997
    30/09/2022
    next

    and Done!

    Which is "disturbing" as the Iconv resolves to a NULL date!

    Any ideas (please)

    Thanks

    Stefano



    ------------------------------
    Stefano Gallotta
    Managing Member
    Simply Red Open Systems
    Milnerton ZA
    ------------------------------


  • 2.  RE: European Date format

    ROCKETEER
    Posted 10-12-2022 16:03
    Yes, looking at the documentation, it looks like the "E" is in the "outsep" area and not the options, so it makes sense that it's going to work on OCONV only. So, not a bug, but rather a feature that was only half implemented. If you'd like to pursue this further, please open a case.

    ------------------------------
    Brian S. Cram
    Principal Technical Support Engineer
    Rocket Software
    ------------------------------



  • 3.  RE: European Date format

    Posted 10-13-2022 03:32
    Hi Brian

    OK - how do I open a case for this, please? I would also like to open a case regarding my "block comment" query (or rather request) I had some time ago

    Thanks

    ------------------------------
    Stefano Gallotta
    Managing Member
    Simply Red Open Systems
    Milnerton ZA
    ------------------------------



  • 4.  RE: European Date format

    ROCKETEER
    Posted 10-13-2022 10:07
    If you have an RBC login, you can open one there I think. I don't know how to do that. A lot of people will email support@rocketsoftware.com with a small description of your issue. Make sure you specify that it's D3 and please include a system ID number.

    ------------------------------
    Brian S. Cram
    Principal Technical Support Engineer
    Rocket Software
    ------------------------------



  • 5.  RE: European Date format

    PARTNER
    Posted 10-13-2022 07:37
    Is it case sensitive by any chance? You use the "e" in the statement but your code has "E".

    ------------------------------
    Alex Polglaze

    The Book-Keeping Network
    Perth Western Australia
    +61419 776 348
    apolglaze@book-keepingnetwork.com.au
    https://www.book-keepingnetwork.com.au/
    ------------------------------



  • 6.  RE: European Date format

    Posted 10-13-2022 08:16
    Hi Alex

    No, the first thing I checked :)


    ------------------------------
    Stefano Gallotta
    Managing Member
    Simply Red Open Systems
    Milnerton ZA
    ------------------------------



  • 7.  RE: European Date format

    Posted 10-13-2022 09:25
    Edited by Alberto Leal 10-13-2022 09:29

    Hy i use the statement 

    SET-DATE-EUR

    in my logon macro of the account.. so all my dates are convert to this format and also inside programs



    *My_Date = '30/09/2022'
    *crt My_Date
    crt 'Now Eurpoean'
    EXECUTE 'set-date-eur'   ;* European
    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/')
    crt d
    crt 'Now American'
    EXECUTE 'set-date-std'   ;* American
    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/')
    crt d
    crt ' and Done!'

    https://www3.rocketsoftware.com/rocketd3/support/documentation/d3nt/102/refman/TCL/set_date_eur_command.htm#reference5811



    ------------------------------
    Alberto Leal
    System Analyst
    Millano Distribuidora de Auto Pecas Ltda
    Varzea Grande MT BR
    ------------------------------



  • 8.  RE: European Date format

    Posted 10-13-2022 09:58

    Hi Alberto,

    Yes thanks, aware of the set-date-eur line in coldstart.
    I was just (disturbed) that the ICONV would not return a valid date when I JUST OCONV the (valid) date.

    Brian explained why and all's good thanks :)

    It's just something a developer needs to be made aware of when (and if) you receive an Excel spreadsheet with a date (assume here 'dd/mm/yyyy') and good practice is to ICONV said date.

    This is how I came about this "issue" - no set-date-eur in coldstart - date looks good until you ICONV and OCONV it back with 'D4/E' - and surprise surprise it's NULL

    [Per my test example:]

    But thanks :)

    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/E')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/E')
    crt d
    crt ' and Done!'


    ------------------------------
    Stefano Gallotta
    Managing Member
    Simply Red Open Systems
    Milnerton ZA
    ------------------------------



  • 9.  RE: European Date format

    Posted 10-13-2022 10:05

    Hy Stefano... 

    my first awnser as incomplete...

    then i editid 
      alternative you can use

    *My_Date = '30/09/2022'
    *crt My_Date
    crt 'Now Eurpoean'
    EXECUTE 'set-date-eur'   ;* European
    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/')
    crt d
    crt 'Now American'
    EXECUTE 'set-date-std'   ;* American
    b_date = '19997'
    crt b_date
    c = Oconv(b_date, 'D4/')
    crt c
    crt 'next '
    d = Iconv(c, 'D4/')
    crt d
    crt ' and Done!'


    ------------------------------
    Alberto Leal
    System Analyst
    Millano Distribuidora de Auto Pecas Ltda
    Varzea Grande MT BR
    ------------------------------



  • 10.  RE: European Date format

    Posted 10-13-2022 10:22
    Edited by Alberto Leal 10-13-2022 10:23

    you can do something like this

    PROGRAM CONVERTDATE  (DATE$CON)
    DATE   = FIELD(DATE$CON,"/",1)

    MONTH = FIELD(DATE$CON,"/",2)

    YEAR = FIELD(DATE$CON,"/",3)

    DATE$CON = MONTH:"/"DATE:"/":YEAR

    EXECUTE 'SET-DATE-STD'

    DATE$CON = ICONV(DATE$CON,"D4/")

    RETURN

    -----------------------------------------------

    DATE$E = "13/10/2022" ;* EUROPEAN DATE

    DATA$AMERICAN = ICONV(DATE$,"CALL CONVERTDATE)



    ------------------------------
    Alberto Leal
    System Analyst
    Millano Distribuidora de Auto Pecas Ltda
    Varzea Grande MT BR
    ------------------------------



  • 11.  RE: European Date format

    Posted 10-14-2022 14:09
    Hi Stefano,

    While I have no practical experience with European dates, I did play around with this a bit.

    I found it odd that the "e" and "u" options were put in the "outsep" section.
    It almost makes me think that these are not true options, but the ICONV command seems to accept them. Strange.

    I could not get input conversion to work with the "e" option but was able to get both input and output conversion to work using the  SET-DATE-STD and SET-DATE-EUR commands.

    In my examples I use the "(L" option so that only my PIB is affected.

    Hope this helps...

    Lance



    Heading = @( 10 ) : 'Internal' : @( 20 ) : 'External' : @( 35 ) : 'Internal(Conv)'

    CRT @( -1 ) : 'Current SET-DATE setting is US format' ; CRT
    Today = DATE()
    TodayOut = Today'D4/'
    TodayIn = TodayOut'DI'
    CRT Heading
    CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
    CRT

    CRT "EXECUTE 'SET-DATE-EUR (L' command"
    CRT 'Current SET-DATE setting is European format' ; CRT
    EXECUTE 'SET-DATE-EUR (L'

    Today = DATE()
    TodayOut = Today'D4/'
    TodayIn = TodayOut'DI'
    CRT Heading
    CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
    CRT

    CRT "EXECUTE 'SET-DATE-STD (L' command"
    CRT 'Current SET-DATE setting is US format' ; CRT
    EXECUTE 'SET-DATE-STD (L'

    Today = DATE()
    TodayOut = Today'D4/'
    TodayIn = TodayOut'DI'
    CRT Heading
    CRT 'Today:' :@( 10 ): Today : @(20) : TodayOut : @(35) : TodayIn
    CRT
    CRT

    Output:

    Current SET-DATE setting is US format

                      Internal     External                Internal(Conv)
    Today:   20011          10/14/2022          20011

    EXECUTE 'SET-DATE-EUR (L' command
    Current SET-DATE setting is European format

                     Internal     External                Internal(Conv)
    Today:  20011          14/10/2022           20011

    EXECUTE 'SET-DATE-STD (L' command
    Current SET-DATE setting is US format

                     Internal     External               Internal(Conv)
    Today:  20011           10/14/2022        20011



    ------------------------------
    Lance Mcmillin
    Sr Programmer Analyst
    Health Advocates
    Sherman Oaks CA US
    ------------------------------