Print the date in Word Fromat

tejateja Member Posts: 78
hi Experts,

I would like to print the date in words..

As if , for example: April 2 2008 means , It should display as April two Two Thousand Eight [\b] . PLease help me to sort from this problem


Thanks in Advance..

TEJA

Answers

  • sendohsendoh Member Posts: 207
    I would like to print the date in words..

    is this a client requirements? anyway this is much easier than to amount in words... see the report 1401 - check you can use that for your reference...there's no standard nav code on what do you want to do, you have to make your own algorithm for this..
    Sendoh
    be smart before being a clever.
  • gdkve9gdkve9 Member Posts: 161
    sendoh wrote:
    this is much easier than to amount in words... see the report 1401

    My dear fren, that report 1401 mainly prints the amount value which is in decimal in to text and that is not helpful for printing date format in the text format. Also printing date in to text is not easier than printing amount in to text i feel. If you could suggest any solution other than using report 1401, it would be grateful.

    Hope someone could comeout with a solution for this as this forum is an experts living forum...

    Thanks in advance to u all guys.
    Dilip
    Falling down is not a defeat..defeat is when you refuse to get up.
  • pri_1_ranjanpri_1_ranjan Member Posts: 67
    be an expert urself .. write your own code! do share with us once done :)
    /PDR
  • gdkve9gdkve9 Member Posts: 161
    be an expert urself .. write your own code!

    Thanq my dear ranjan for Ur valuable suggestion :evil: . But I would like to tell you one thing people approach mibuso and post their quieries only after they try their best and even if they could not able to solve the issue as mibuso forum has many experieced guys who can suggest in solving the issue. I meant them as experts..
    Dilip
    Falling down is not a defeat..defeat is when you refuse to get up.
  • sadynamicssadynamics Member Posts: 42
    Hi Teja,

    Try to create function !! i have tried. Experts should say it is fine or not.
    in request form get the date variable.


    dttext : Variable Text (30)
    Date Value : Variable Date (get it in request form)
    dytext : Variable Text (30)

    Dttext:=FORMAT(Datevalue);
    Dttext:=DELSTR(Dttext,3,6);
    day:=Dttext;
    IF day='01' THEN
    Dytext:='First';
    IF day='02' THEN
    Dytext:='Second';

    like wise do for month and year. You should get this below said output.
    Its just hard coding but there is no way to do !!


    Try and tell me if you are having any problems in that...
    Luv,
    Dynamics Lover
  • krzychub83krzychub83 Member Posts: 120
    Not tested ;), but it should give You this result:
    April two Two Thousand Eight
    Remember to end the Case block
    [code]
    OBJECT Form 50003 DateToTXT
    {
      OBJECT-PROPERTIES
      {
        Date=08-04-11;
        Time=14:15:55;
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=4400;
        Height=990;
      }
      CONTROLS
      {
        { 1000000000;TextBox;110  ;220  ;1700 ;440  ;SourceExpr=myDate }
        { 1000000001;CommandButton;1980;220;2200;550;CaptionML=[ENU=Print;
                                                                PLK=Drukuj];
                                                     OnPush=VAR
                                                              TextToPrint@1000000000 : Text[250];
                                                              Day@1000000001 : Integer;
                                                              Year@1000000002 : Integer;
                                                            BEGIN
                                                              IF myDate <> 0D THEN
                                                              BEGIN
                                                                Day := DATE2DMY(myDate, 1);
                                                                Year := DATE2DMY(myDate, 3);
                                                                TextToPrint:= FORMAT( myDate, 0,'<Month Text>');
                                                                TextToPrint:= TextToPrint + ' ' + ChangeValueDay(Day) + ', ' + ChangeValueYear(Year);
                                                                MESSAGE(TextToPrint);
                                                              END;
                                                            END;
                                                             }
      }
      CODE
      {
        VAR
          myDate@1000000000 : Date;
    
        PROCEDURE ChangeValueDay@1000000001(MyDateInt@1000000000 : Integer) : Text[30];
        BEGIN
          CASE MyDateInt OF
            0: EXIT('Zero');
            1: EXIT('One');
            2: EXIT('Two');
            3: EXIT('Three');
            4: EXIT('Four');
            5: EXIT('Five');
            6: EXIT('Six');
            7: EXIT('Seven');
            8: EXIT('Eight');
            9: EXIT('Nine');
            10: EXIT('Ten');
            // ..
            // 31
          END;
        END;
    
        PROCEDURE ChangeValueYear@1000000002(MyDateInt@1000000000 : Integer) : Text[250];
        VAR
          TMPText@1000000001 : Text[250];
        BEGIN
          IF ((MyDateInt/1000) > 1) THEN
          BEGIN
            TMPText:= ChangeValueDay(MyDateInt DIV 1000) + ' Thousend ';
          END;
    
          MyDateInt := MyDateInt MOD 1000;
    
          IF ((MyDateInt/100) > 1 ) THEN
          BEGIN
            TMPText:=TMPText + ChangeValueDay( MyDateInt DIV 100) + ' Houndred ';
          END;
          MyDateInt := MyDateInt MOD 100;
    
          IF ((MyDateInt/10) > 1 ) THEN
          BEGIN
            TMPText:=TMPText + ChangeValueDay( MyDateInt DIV 10) + ' Ten ';
          END;
          TMPText:=TMPText + ChangeValueDay( MyDateInt MOD 10);
          EXIT(TMPText);
        END;
    
        BEGIN
        END.
      }
    }
    
    [/code]
  • XypherXypher Member Posts: 297
    I haven't tested this so I'm not sure if it'll work.. But what if you just pass separate values to report 1401?
    //Date To Text!
    dtt_month := FORMAT(DateVar,0,'<Month Text>');
    //dtt_ day & year both decimal
    EVALUATE(dtt_day,DATE2DMY(DateVar,1));
    EVALUATE(dtt_year,FORMAT(DateVar,0,'<Year4>'));
    
    ReportVar.FormatNoText(dtt_text_day,dtt_day,'REMOVEME');
    ReportVar.FormatNoText(dtt_text_year,dtt_year,'REMOVEME');
    
    dtt_text_result := dtt_month + ' ' +
                       DELCHR(dtt_text_day,'=','REMOVEME') + ', ' +
                       DELCHR(dtt_text_year,'=','REMOVEME');
    


    Let me know if it works :D

    Only problem I see the day representation. If it's 22 will show as Twenty Two rather than Twenty Second.. but from your first post your example shows "April Two..." so this should do it :D
  • tejateja Member Posts: 78
    Hi Experts ,


    Thanks for your valuable suggests ..

    with All your suggestions I am able to work it out =D> =D> =D>

    Thanks Again for every one =D>
Sign In or Register to comment.