Results 1 to 7 of 7
  1. #1
    Join Date
    Aug 2004
    Location
    Cinci, OH
    Posts
    49

    Unanswered: Dates and day of the week.

    Hey all,

    First of thanks very much in advance for any info or suggestions:

    Can access determine what day of the week (mon, tue, wed) by the date?

    Like Sept 23, 2005 is Friday. How would Access know that Sept 23 is a Friday?

    Can Access do this with a past date?

    If so what does the code need to say/any coding examples?

    Thanks very much.
    Richard.
    Last edited by rmousir; 10-19-05 at 20:00.

  2. #2
    Join Date
    Jan 2005
    Posts
    6
    Use the weekday function in conjunction with the weekdayname function, like so:

    weekdayname(weekday(#10/19/2005#))

    returns Wednesday

  3. #3
    Join Date
    Aug 2004
    Location
    Cinci, OH
    Posts
    49
    Thanks. Is there any other ways to go about doing this. I am looking for different ways to handle this. I have a large old table that i will have to work with and I don't know which is the best way to go about the query that I need but i need to know what day each record is.

    Other suggestions will be very helpful in finding the best way to approach this.

    As always,

    Thanks very much for your time and input.

    Richard.

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    Format([DateField],"dddd")
    Paul

  5. #5
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    There is the DatePart function.

  6. #6
    Join Date
    Aug 2004
    Location
    Cinci, OH
    Posts
    49
    I have never see the datepart function. Can you please give a example or is it one of the already posted codes?

    Richard.

    Thanks very much.

  7. #7
    Join Date
    Jan 2005
    Posts
    6
    datepart returns an integer containing the specified part of the given date

    ex:
    datepart("yyyy", Now) ' the year
    2005

    datepart("m", Now) ' the month
    10

    the interval, in the above case yyyy and m, can be the following:
    yyyy Year
    q Quarter
    m Month
    y Day of year
    d Day
    w Weekday
    ww Week
    h Hour
    n Minute
    s Second

    hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •