using date function to extract the actual day of the week

G

Guest

Is there any way I can use a date field to extract the day of the week? I
know that you can use the YEAR or MONTH or DAY function to extract the number
- for example 2005/11/01 becomes 2005, 11, 1. Is there any way that convert
tne number 1 (for day) into the actual day of the week that that number
represents? eg Monday, 31, 10, 2005 or Tuesday, 1, 11, 2005 etc.

cheers,

Pedro
 
M

Marshall Barton

pedro said:
Is there any way I can use a date field to extract the day of the week? I
know that you can use the YEAR or MONTH or DAY function to extract the number
- for example 2005/11/01 becomes 2005, 11, 1. Is there any way that convert
tne number 1 (for day) into the actual day of the week that that number
represents? eg Monday, 31, 10, 2005 or Tuesday, 1, 11, 2005 etc.


Those are just shorthand versions of the DatePart function.

Try using DatePart("w", datefield)
 
J

John Vinson

Is there any way I can use a date field to extract the day of the week? I
know that you can use the YEAR or MONTH or DAY function to extract the number
- for example 2005/11/01 becomes 2005, 11, 1. Is there any way that convert
tne number 1 (for day) into the actual day of the week that that number
represents? eg Monday, 31, 10, 2005 or Tuesday, 1, 11, 2005 etc.

cheers,

Pedro

DatePart("w", [datefield])

will return 1 for Sunday, 2 for Monday, ... , 7 for Saturday. See the
VBA online help for DatePart, it has options to change the day
starting the week, and other date parts you can choose.

John W. Vinson[MVP]
 
J

John Spencer

If you want the NAME of the day, you can use the format function.

Format([DateField],"ddd") for "Mon"
Format([DateField],"dddd") for "Monday"

John Vinson said:
Is there any way I can use a date field to extract the day of the week? I
know that you can use the YEAR or MONTH or DAY function to extract the
number
- for example 2005/11/01 becomes 2005, 11, 1. Is there any way that
convert
tne number 1 (for day) into the actual day of the week that that number
represents? eg Monday, 31, 10, 2005 or Tuesday, 1, 11, 2005 etc.

cheers,

Pedro

DatePart("w", [datefield])

will return 1 for Sunday, 2 for Monday, ... , 7 for Saturday. See the
VBA online help for DatePart, it has options to change the day
starting the week, and other date parts you can choose.

John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top