harmonv
Oct 14, 2006
- "slight change to dow function"
__Liberty==__Liberty Basic Day and DateRoutines__Routines__==LB===LB day-of-weekconversion.conversion=== This routine uses LB's built-in date$() function.InIn the LB universe, day 0 was Jan 1,1901. Dates1901 and dates before 1/1/1901 return negative numbers. It will accept 1- or 2-digit numbers for the month and dayandand 1, 2, 3 or 4-digit numbers for the year.YearsYears from00 to 99 are assumed as 2000 to 2099.ItIt will also acceptfullyfully typed month names or 3-letter abbreviations.SomeSome examples:JulJul 4,2006 -- July06 -- July 04, 2006-- 07/04/2006 7/4/6 -- 7/4/06 -- 7/4/2006 -- 07/04/06 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.-- 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. [[code format="vb.net"]] ' Return day-of-week for d$ function dayofweek$(dt$) day = date$(dt$) mod 7 + 7 ' +7 for dates before Jan 1, 1901 select case (day mod 7) case0:0: d$ = "Tuesday" case-6,1:1: d$ = "Wednesday" case-5,2:2: d$ = "Thursday" case-4,3:3: d$ = "Friday" case-3,4:4: d$ = "Saturday" case-2,5:5: d$ = "Sunday" case-1,6:6: d$ = "Monday" end select dayofweek$ = d$ end function [[code]] ===Gregorian Year, Month, Day to Julian Day #=== --- coming soon --- ===Julian Day to Gregorian Year, Month, Day=== --- coming soon --- ---- Take care > -- [[user:harmonv]]