Loading ...
Sorry, an error occurred while loading the content.

weekday

Expand Messages
  • Adly
    I found an old program I wrote. It goes like this: code begins here..... ID=7 day of month IM=12 month IY=2001 year print WkDay$(ID,IM,IY) WkDay
    Message 1 of 5 , Feb 28, 2005
    • 0 Attachment
      I found an old program I wrote. It goes like this:
      'code begins here.....
      ID=7 'day of month
      IM=12 ' month
      IY=2001 'year
      print WkDay$(ID,IM,IY)
      '
      'WkDay Returns WEEKDAY given DAY, MONTH, YEAR
      ' ID=day IM=month IY=year
      '
      function WkDay$(ID,IM,IY)
      dim WD$(7)
      WD$(1)="Monday"
      WD$(2)="Tuesday"
      WD$(3)="Wednesday"
      WD$(4)="Thursday"
      WD$(5)="Friday"
      WD$(6)="Saturday"
      WD$(7)="Sunday"
      JM=12*(IY+4800)+IM-3
      J=int((2*(JM-int(JM/12)*12)+7+365*JM)/12)
      JD=J+ID+int(JM/48)-32083
      if (JD<=2299171) then goto [1]
      JD=JD+int(JM/4800)-int(JM/1200)+38
      [1] WkDay$=WD$((JD-int(JD/7)*7)+1)
      end function

      end

      The only thing is I was hoping to get a form of Liberty Basic command
      for the weekday.
      If anyone knows of one in LB I may have overlooked, I would greatly
      appreciate it being pointed out.
      Adly
    • seekaye2003
      ... command ... greatly ... is this what you re after ? (watch for text wrapping) CODE BEGIN print whatdayisit$() end function whatdayisit$() struct
      Message 2 of 5 , Mar 1, 2005
      • 0 Attachment
        <snip>
        > The only thing is I was hoping to get a form of Liberty Basic
        command
        > for the weekday.
        > If anyone knows of one in LB I may have overlooked, I would
        greatly
        > appreciate it being pointed out.
        > Adly

        is this what you're after ? (watch for text wrapping)

        'CODE BEGIN
        print whatdayisit$()
        end

        function whatdayisit$()
        struct currenttime, _
        year as word, _
        month as word, _
        dayofweek as word, _
        day as word, _
        hour as word, _
        minute as word, _
        second as word, _
        millisecond as word

        calldll #kernel32, "GetSystemTime", currenttime as struct, result as
        void

        day=currenttime.dayofweek.struct
        if day=0 then whatdayisit$="Sunday"
        if day=1 then whatdayisit$="Monday"
        if day=2 then whatdayisit$="Tuesday"
        if day=3 then whatdayisit$="Wednesday"
        if day=4 then whatdayisit$="Thursday"
        if day=5 then whatdayisit$="Friday"
        if day=6 then whatdayisit$="Saturday"


        end function
        'CODE END

        its adapted from a recent thread on time pickers

        chris
      • bbjen@hotPOP.com
        ... Here s a quick way, using LB s date$() function (good for days since Jan 1, 1901) : day=date$( days ) dywk$= Sun Mon Tue Wed Thu Fri Sat
        Message 3 of 5 , Mar 1, 2005
        • 0 Attachment
          At 05:25 PM 3/1/05 -0000, you wrote:

          >> The only thing is I was hoping to get a form of Liberty Basic
          >command
          >> for the weekday.
          >> If anyone knows of one in LB I may have overlooked, I would
          >greatly
          >> appreciate it being pointed out.
          >> Adly
          >-----------------------------------------------

          Here's a quick way, using LB's date$() function (good for days since Jan 1,
          1901) :

          day=date$("days")
          dywk$="Sun Mon Tue Wed Thu Fri Sat"
          n=day-int(day/7)*7+3
          print day;" ";word$(dywk$,n)

          If you want it for some other date, get 'day' using this form:
          day=date$("12/1/2005")

          Bill J.
        Your message has been successfully submitted and would be delivered to recipients shortly.