DayOfWeek

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amolbehl
    New Member
    • May 2007
    • 63

    #1

    DayOfWeek

    Hi I am trying to get dayofweek for the given date.

    Dim d As Date

    d = DateTime.Now

    when I tried d.dayofweek, it gave an error. Is there some reference I need to add??
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Dim TDay As String

    TDay = d.dayofweek.ToS tring

    Regards
    Veena

    Comment

    • amolbehl
      New Member
      • May 2007
      • 63

      #3
      I tried the following
      Dim d As Date
      Dim str1 As String

      d = DateTime.Now

      str1 = d.dayofweek.ToS tring
      'str1 = CStr(DateTime.N ow.dayofweek)

      MsgBox str1

      when I use
      str1 = d.dayofweek.ToS tring I get "invalid qualifier" and 'd' is highlighted.
      When I use
      str1 = CStr(DateTime.N ow.dayofweek)
      it gives an error "Object Required"

      basically dayofweek is not working for me
      Is there a dayofweek in VB6???

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        In VB6 you would use the Format() function on a date field. There are parameters to return the full or abbreviated day name. Here's one sample from the doco...

        MyStr = Format(MyDate, "dddd, mmm d yyyy") ' Returns "Wednesday, Jan 27 1993".

        Which gives you some idea how old the doco is. :)

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Hi,

          As Killer suggested:

          Format(DATE,"DD DD")
          Will give you Today's Week day.
          I thought you were using VB.Net and gave you that syntax..

          REgards
          Veena

          Comment

          • amolbehl
            New Member
            • May 2007
            • 63

            #6
            Hey thanks a lot guys you are really great help :-)

            Comment

            Working...