using date function to extract the actual day of the week

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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)
 
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]
 
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]
 
Back
Top