Extract of CMonth from Date

shrwetamshrwetam Member Posts: 6
Dear All,

May I know how to extract month as a character from Date?

I have used DATE2DMY to extract months as integer by passing 2 as parameter

But how can I get month as APRIL,MAY i.e. as character from date?

e.g if date is 01/04/2009, month is 4

but I need months as 'April'

Thanks

Comments

  • mihail_kolevmihail_kolev Member Posts: 379
    CASE month OF
    1:txtMonth:='January';
    2:txtMonth:='February';
    ....................
    END;
    :whistle:
    -Mihail- [MCTS]
  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    No way :roll:

    Use format(<date>,0,'<month text>').
    Use some time to check out the help for the format-property!
    Great things are revealed there :)
    With Kind Regards
    Thoms Hviid Thorn
  • mihail_kolevmihail_kolev Member Posts: 379
    No way :roll:

    Use format(<date>,0,'<month text>').
    Use some time to check out the help for the format-property!
    Great things are revealed there :)

    In which language it is returned, btw? Windows config or client config?

    PS: I see i'm not the only who skip the C/SIDE Reference Guide :oops:
    -Mihail- [MCTS]
  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    Client I guess - never had that as a problem (I allways needed the client language).

    But - on you way to the books - check out the Multilanguage sections too :D

    :!: anyway - you'll find, that I'm not allways right in my responses too :-#
    With Kind Regards
    Thoms Hviid Thorn
  • krikikriki Member, Moderator Posts: 9,110
    How about this one:

    datDate := TODAY;
    
    recDate.RESET;
    recDate.SETRANGE("Period Type",recDate."Period Type"::Month);
    recDate.SETRANGE("Period Start",0d,datDate);
    recDate.FINDLAST;
    MESSAGE('Monthname <%1>',recDate."Period Name");
    

    [Topic moved from 'NAV 2009' forum to 'NAV/Navision' forum]
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • Thomas_Hviid_ThornThomas_Hviid_Thorn Member Posts: 92
    :-k hmm, I don't see how that's better than
    message('%1',format(today,0,'<month text>');
    

    1) four lines of code extra and one variable
    2) does the Date table require I/O ? Guess not, but If - that's overhead too

    but the result is the same, and it too is multilanguage enabled
    With Kind Regards
    Thoms Hviid Thorn
  • krikikriki Member, Moderator Posts: 9,110
    1) you can put this code into some library of functions, so you program it only once.
    2) No overhead. All is in memory/CPU.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • shrwetamshrwetam Member Posts: 6
    Thanku all

    Actually I want to create drill down report for Purchase Receipt Summary report based on Month filteration i.e first screen of Month list & on selection of month-- list of all Receipts-- then on selection of CPL -- goes to actual posted receipt voucher

    I got the soultion from post posted by you all
  • David_SingletonDavid_Singleton Member Posts: 5,479
    PS: I see i'm not the only who skip the C/SIDE Reference Guide :oops:

    I see you also did not read the w1w1term.pdf Terminology Handbook either. :whistle:
    CASE month OF
    1:txtMonth:='January';
    2:txtMonth:='February';
    ....................
    END;
    David Singleton
Sign In or Register to comment.