harmonv
Oct 14, 2006
- "slight change to dow function"
Liberty Basic Day and Date Routines
LB day-of-week conversion
This routine uses LB's built-in date$() function. In the LB universe, day 0 was Jan 1, 1901 and dates before 1/1/1901 return negative numbers.
It will accept 1- or 2-digit numbers for the month and day and 1, 2, 3 or 4-digit numbers for the year. Years from
0 to 99 are assumed as 2000 to 2099. It will also accept fully typed month names or 3-letter abbreviations.
Some examples: Jul 4, 06 -- July 04, 2006 -- 7/4/6 -- 07/04/2006
Be aware that negative years are incorrectly handled as positive, so LB's date$() function can not be relied upon for any date earlier than Jan 1, 100.
' Return day-of-week for d$function dayofweek$(dt$)
day =date$(dt$)mod7+7' +7 for dates before Jan 1, 1901selectcase(day mod7)case0: d$ ="Tuesday"case1: d$ ="Wednesday"case2: d$ ="Thursday"case3: d$ ="Friday"case4: d$ ="Saturday"case5: d$ ="Sunday"case6: d$ ="Monday"endselect
dayofweek$ = d$
endfunction
Liberty Basic Day and Date Routines
LB day-of-week conversion
This routine uses LB's built-in date$() function. In the LB universe, day 0 was Jan 1, 1901 and dates before 1/1/1901 return negative numbers.It will accept 1- or 2-digit numbers for the month and day and 1, 2, 3 or 4-digit numbers for the year. Years from
0 to 99 are assumed as 2000 to 2099. It will also accept fully typed month names or 3-letter abbreviations.
Some examples: Jul 4, 06 -- July 04, 2006 -- 7/4/6 -- 07/04/2006
Be aware that negative years are incorrectly handled as positive, so LB's date$() function can not be relied upon for any date earlier than Jan 1, 100.
Gregorian Year, Month, Day to Julian Day #
--- coming soon ---Julian Day to Gregorian Year, Month, Day
--- coming soon ---Take care