Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

10-char date with USING$

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 10-char date with USING$

    This one took me forever to figure out
    Comments: https://forum.powerbasic.com/forum/u...using-comments
    Code:
    MACRO date10(m,d,y) = USING$("*0*0/*0/##",m,d,y)
    FUNCTION PBMAIN () AS LONG
     ? date10(m&,d&,y&)  '00/00/0000
    END FUNCTION'
    Last edited by Mike Doty; 17 Jan 2021, 01:01 AM.

  • #2
    MACRO: 8-char or 10-char date
    Code:
    'Pass year 0-99       return 8-character date
    'Pass year 1000-9999  return 10-character date
    
    MACRO mydate(month,day,year) = USING$("*0*0/*0/*0",month,day,year)
    
    FUNCTION PBMAIN AS LONG
    
     ? mydate(1,18,21)    '01/18/21
     ? mydate((1,18,2021) '01/18/2021
    
    END FUNCTION

    Comment

    Working...
    X