Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Time - Not a Library
#2
In case anyone is thinking of grabbing bits for use in their own code, I would say that there are probably only 3 routines that really have a use outside of the package. So to save you time I have copied them out and pasted them below -

Code: (Select All)
FUNCTION DayOfWeek(Year$, Month%, Day%)
    DIM Year%, Code%
    Year% = VAL(Year$)
    Code% = VAL(RIGHT$(YEAR$, 2))
    Code% = (Code% + (Code% \ 4)) Mod 7
    Code% = Code% + VAL(MID$("033614625035", Month%, 1))
    IF (YEAR% >= 2000) THEN
        Code% = Code% + 6
    END IF
    IF (((Year% MOD 400) = 0) AND (Month% > 2))THEN
        Code% = Code% + 1
    ELSEIF (((Year% MOD 4) = 0) AND ((Year% MOD 100) <> 0) AND (Month% > 2)) THEN
        Code% = Code% + 1
    END IF
    Code% = Code% + Day%
    DayOfWeek = 1 + (Code% MOD 7)
END FUNCTION

SUB GetDate(Year%, Month%, Day%, WeekDay%)
    DIM TempDate$
    TempDate$ = DATE$
    Year% = VAL(RIGHT$(TempDate$, 4))
    Month% = VAL(LEFT$(TempDate$, 2))
    Day% = VAL(MID$(TempDate$, 4, 2))
    WeekDay% = DayOfWeek(LTRIM$(STR$(Year%)), Month%, Day%)
END SUB

and

Code: (Select All)
SUB GetTime(Hours%, Minutes%, Seconds%)
    DIM AllSeconds AS LONG
    AllSeconds = TIMER
    Hours% = AllSeconds \ 3600
    AllSeconds = AllSeconds MOD 3600
    Minutes% =  AllSeconds \ 60
    Seconds% = AllSeconds MOD 60
END SUB

enjoy.

TR
Reply


Messages In This Thread
Time - Not a Library - by TarotRedhand - 05-18-2022, 03:31 PM
RE: Time - Not a Library - by TarotRedhand - 05-18-2022, 03:38 PM



Users browsing this thread: 2 Guest(s)