Last active
June 28, 2024 20:11
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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