Skip to main content
guest
Join | Help | Sign In
Liberty BASIC Community Wiki Home
guest| Join | Help | Sign In
Liberty BASIC Community Wiki
  • Wiki Home
  • Recent Changes
  • Pages and Files
  • Members
  • Home
    • Liberty BASIC FAQ
    • Contests
    • Tutorials
    • Science
    • Shared Code
    • Tips
    • DLLs
    • PublicDomainSprites
    • Member Pages
    • Links
    • Sandbox

Day and Date Functions

Edit 0 4 …
  • 0 Tags
    • No tags
  • Notify
  • RSS
  • Backlinks
  • Source
  • Print
  • Export (PDF)
Older Version Newer Version

harmonv harmonv Oct 12, 2006 - "New article: day-of-week 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. 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, 2006 -- 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. [[code format="vb.net"]] ' Return day-of-week for d$ function dayofweek$(dt$) day = date$(dt$) select case (day mod 7) case 0: d$ = "Tuesday" case -6,1: d$ = "Wednesday" case -5,2: d$ = "Thursday" case -4,3: d$ = "Friday" case -3,4: d$ = "Saturday" case -2,5: d$ = "Sunday" case -1,6: d$ = "Monday" end select dayofweek$ = d$ end function [[code]] ---- Take care > -- [[user:harmonv]]
Help · About · Pricing · Privacy · Terms · Support · Upgrade
Contributions to https://basic.wikispaces.com/ are licensed under a Creative Commons Attribution Share-Alike 2.5 License. Creative Commons Attribution Share-Alike 2.5 License
Portions not contributed by visitors are Copyright 2018 Tangient LLC
TES: The largest network of teachers in the world
Turn off "Getting Started"
  1. Home
  2. ...
Loading...