Menu

My First program

Tuxtoo
2020-04-14
2020-04-14
  • Tuxtoo

    Tuxtoo - 2020-04-14

    Just bought 'The Waite Group's GW_BASIC Primer Plus' from Amazon and have started working my way through the book. The first issue I have is with DATE$, it returns the date in the U.S. Format (mm-dd-yyy), but I would rather have the date in the European Format (dd-mm-yyyy).

    I may be getting ahead of myself, but I have written a subroutine to convert DATE$ to the European Format in the form '14 Apr 2020' so there is no confusion between the U.S. And European Format. As this is my first program I would be grateful if anyone cares to comment on whether I have done this correctly or is there a more efficient way of doing this.

    100 GOSUB 1000
    110 PRINT D$
    120 END
    130 '
    140 '
    1000 'Convert DATE$ to an unambiguous format returned in D$
    1010 OPTION BASE 1
    1020 DIM M$(12)
    1030 DATA "Jan","Feb","Mar","Apr","May","Jun"
    1040 DATA "Jul","Aug","Sep","Oct","Nov","Dec"
    1050  FOR I=1 TO 12
    1060    READ M$(I)
    1070  NEXT I
    1080 '
    1090 D$=DATE$
    1100 DAY$=MID$(D$,4,2)
    1110 MONTH=VAL(LEFT$(D$,2))
    1120 YEAR$=RIGHT$(D$,4)
    1130 '
    1140 ' Swap position of D$=DAY$ and M$(MONTH) for US date format.
    1150 D$=DAY$+" "+M$(MONTH)+" "+YEAR$
    1160 RETURN
    

    Stuart

     

    Last edit: Tuxtoo 2020-04-14
  • Smithdoor

    Smithdoor - 2020-04-14

    It runs good
    Good job
    The dtae format was used for filing be for computer's
    It is now the standard in the USA

    Dave

     

    Last edit: Smithdoor 2020-04-14
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.