Results 1 to 4 of 4
  1. #1
    3 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    220
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Dates to day of week (2002)

    I have a table in which a field is formatted as a general date: 5/16/2003 3:50:59 PM. Is there a way to build a query that will filter the records to show only records on which the above date/time field equaled a Sunday, without changing the format? Thanks.
    JimmyW
    Helena, MT

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dates to day of week (2002)

    Create a query based on your table.
    Add the fields you want to see.
    Add a calculated column:

    WeekDay([DateField])

    where DateField is the name of the date field.
    Clear the Show check box for this column.
    Set the criteria for this column to 1 (1 = Sunday, 2 = Monday, ..., 7 = Saturday)

  3. #3
    3 Star Lounger Jimmy-W's Avatar
    Join Date
    Jan 2001
    Location
    Helena, Montana, USA
    Posts
    220
    Thanks
    13
    Thanked 0 Times in 0 Posts

    Re: Dates to day of week (2002)

    Thanks very much, Hans. Works great! I also figured out that I could use Year([date_field]) with a criterion of 2003 to get all Sundays in that year.
    JimmyW
    Helena, MT

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Dates to day of week (2002)

    Hans already told you how to do it, but I just wanted to add one little bit FYI. Don't confuse formatting with data. Even the default formatting for a field does not in any way change the data or limit what other formatting you want to use. In your case you have a date field. You could display the information in that field with a variety of formats: Long Date, Short Date, Long Time, Short Time, a Custom format, etc. The data is still the same, only what you see of it may change. So, sometimes you may not see all the data in a field because of your formatting, but it is always there.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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