Type Conversion Problem

te6te6 Member Posts: 89
hi Experts,

can a DATE type be converted into DECMIA typeL.....

Is it Possible....


Thanks in Advance...

Comments

  • sendohsendoh Member Posts: 207
    weird thoughts :P try this one..

    vText := FORMAT(vDate);
    IF EVALUATE(vDec,DELCHR(vText,'=','/')) THEN
      MESSAGE('%1',vDec);
    
    Variables     Datatype
    vDate            Date
    vText            Text
    vDec             Decimal
    
    
    Sendoh
    be smart before being a clever.
  • tinoruijstinoruijs Member Posts: 1,226
    Just curious. What are you going to do with the "date-in-decimal"? Where is it for?

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • kinekine Member Posts: 12,562
    And what will be the meaning of the decimal? If you tell us the key you are expecting (the mapping function between the date and decimal), may be that there will be solution, but...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • krikikriki Member, Moderator Posts: 9,110
    It would be more logical to convert to integer.
    Something like:
    LintDate :=
    (DMY2DATE(datTheDate,3) * 10000) +
    (DMY2DATE(datTheDate,2) * 100) +
    (DMY2DATE(datTheDate,1));

    This gives you an integer (or also decimal) in the form YYYYMMDD.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • gdkve9gdkve9 Member Posts: 161
    kine wrote:
    And what will be the meaning of the decimal? If you tell us the key you are expecting (the mapping function between the date and decimal), may be that there will be solution, but...

    By that he mean to say, he is looking for the solution to convert the date to text. Mr. te6 has posted his query to convert form date-to-decimal because the report 1401 converts the decimal to text. So he was stuck at converting first from date to decimal. Once this is done, then that decimal can be converted to text using report 1401.

    But again the problem exists with report 1401 because that report converts only amounts in decimals to text format but may not give the date converted to decimal in the required text format. I mean to say..

    Amount(decimal) := 2515.06
    Amount(text) := Two Thousasnd Five Hundred Fifteen Rupees Zero Six Paisa

    Date := 01/31/2008
    Date(decimal) := 01312008
    Now using report 1401 for this, Date(text) would come as
    Date(text) := Thirteen Billion Twelve Thousand Eight Rupees Zero Paisa
    but not "January Thirty First Two Thousand Eight".

    Its to say Mr.Kine, I am a great admirer of you and let me hope I get some suggestion on this issue from you Sir.

    Regards in Advance..
    Dilip
    Falling down is not a defeat..defeat is when you refuse to get up.
Sign In or Register to comment.