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

weekday

Expand Messages
  • Adly
    How do I get the weekday into my date$( ) command? I want to get a date format like for example: 20:16 Monday, February 28, 2005 I get everything except the
    Message 1 of 5 , Feb 28, 2005
    • 0 Attachment
      How do I get the weekday into my date$( ) command? I want to get a
      date format like for example:
      20:16 Monday, February 28, 2005
      I get everything except the weekday "Monday" part.
      Thanks,
      Adly
    • Storm Dragon
      I have a function that will produce the weekday on my website. The link to it is at the end of this message. Once you get to my site, click on the Liberty
      Message 2 of 5 , Feb 28, 2005
      • 0 Attachment
        I have a function that will produce the weekday on my website. The link to
        it is at the end of this message. Once you get to my site, click on the
        Liberty BASIC link. It is adapted from Zeller's Congruence, I hope I
        spelled that right. Once you paste the code into your project, you can use
        it like:
        currentDay$ = WeekDay$()
        It will assign the current day name to the variable currentDay$ or what ever
        you choose. Please leave me some feedback if you think it can be improved.
        HTH

        Visit my website:
        www.stormdragon.us
        ----- Original Message -----
        From: "Adly" <adly15@...>
        To: <libertybasic@yahoogroups.com>
        Sent: Monday, February 28, 2005 8:23 PM
        Subject: [libertybasic] weekday


        >
        >
        > How do I get the weekday into my date$( ) command? I want to get a
        > date format like for example:
        > 20:16 Monday, February 28, 2005
        > I get everything except the weekday "Monday" part.
        > Thanks,
        > Adly
        >
        >
        >
        >
        >
        >
        > Yahoo! Groups Links
        >
        >
        >
        >
        >
        >
        >
        >
      • 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 3 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 4 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 5 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.