C# and NAV not use the same date format?

julkifli33julkifli33 Member Posts: 1,092
edited 2012-01-09 in NAV Three Tier
hi all
i create codeunit in nav
and it works to import
i'm using web service to access nav from C#
but when i import data (for date type), it tells me '23/12/2011' is not a valid date.
i use the same pc but the date i think from C# itself using MMDDYYYY
how to solve this?

Comments

  • julkifli33julkifli33 Member Posts: 1,092
    my code in codeunit like this
        PostingDateText := FORMAT(COPYSTR(vString,1,PosCode-1));
        EVALUATE(PostingDate,PostingDateText);
        SH."Posting Date" := PostingDate;
    

    is there something wrong?
  • kinekine Member Posts: 12,562
    Depends on how you are passing the date. If you are using paramter of type date, it will work ok. If you are passing it as text, than you need to parse the xml format correctly.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • SogSog Member Posts: 1,023
    There is a build-in function to parse xml-formatted dates.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • julkifli33julkifli33 Member Posts: 1,092
    kine wrote:
    Depends on how you are passing the date. If you are using paramter of type date, it will work ok. If you are passing it as text, than you need to parse the xml format correctly.
    actually postingdate here is variable as date type
  • julkifli33julkifli33 Member Posts: 1,092
    i used this method for posting date, and it works
    i thought there is another method to solve this issue
    anyway, i use this first
Sign In or Register to comment.