Skip to content

Instantly share code, notes, and snippets.

@CarlTBarnes
Last active June 28, 2024 20:11
Show Gist options
  • Select an option

  • Save CarlTBarnes/77ebb46ddcce3ed7c4040f9c31bd571c to your computer and use it in GitHub Desktop.

Select an option

Save CarlTBarnes/77ebb46ddcce3ed7c4040f9c31bd571c to your computer and use it in GitHub Desktop.
DateSplit(Date, Month, Day, Year) much faster than calling MONTH() DAY() YEAR() separately
DateSplit PROCEDURE(LONG Date2Split, <*? OutMonth>, <*? OutDay>, <*? OutYear>)
!==========================================================================================================
DateSplit PROCEDURE(LONG Date2Split, <*? OutMonth>, <*? OutDay>, <*? OutYear>)
!Use DateSplit(Today,M,D,Y) instead of M=MONTH(Today) ; D=DAY(Today) ; Y=YEAR(Today)
D1 DATE,AUTO
DG GROUP, OVER(D1)
D BYTE
M BYTE
Y USHORT
END
CODE
D1=Date2Split
IF ~OMITTED(OutMonth) THEN OutMonth=DG.M.
IF ~OMITTED(OutDay) THEN OutDay=DG.D.
IF ~OMITTED(OutYear) THEN OutYear=DG.Y.
RETURN
!--------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment