DatePart question

  • Thread starter Thread starter obembe
  • Start date Start date
O

obembe

What's the difference between:-

DatePart("q", [OrderDate]) = 1

as found in an Access 2000 help example

and:-

DatePart("q",[OrderDate],1,0)

as found in Northwind's "Quarterly Orders by Product" query?

Regards,

Adetola.
 
The expression DatePart("q",[OrderDate],1,0) will return a positive
Integer value from 1 to 4, depending on the date.

Hello Chris,

What I don't understand here are the last two parts of the argument, i.e.
the "1,0". I tried leaving them out but got the same result. What are the
permissible ranges of those two digits at the end? I even changed them to
something weird like 2014,137 and still got the same result.

Regards,

Adetola Obembe.
 
obembe said:
What's the difference between:-

DatePart("q", [OrderDate]) = 1

as found in an Access 2000 help example

and:-

DatePart("q",[OrderDate],1,0)

as found in Northwind's "Quarterly Orders by Product" query?

Regards,

Adetola.

obembe,

The expression "DatePart("q", [OrderDate]) = 1", can only return True
or False (-1 or 0).

The expression DatePart("q",[OrderDate],1,0) will return a positive
Integer value from 1 to 4, depending on the date.


Sincerely,

Chris O.
 
obembe said:
The expression DatePart("q",[OrderDate],1,0) will return a positive
Integer value from 1 to 4, depending on the date.

Hello Chris,

What I don't understand here are the last two parts of the argument, i.e.
the "1,0". I tried leaving them out but got the same result. What are the
permissible ranges of those two digits at the end? I even changed them to
something weird like 2014,137 and still got the same result.

Those values are for firstdayofweek and firstweekofyear respectively.

Valid values for firstdayofweek are 0 through 7, where 0 means use the NLS
API setting, and 1 through 7 correspond to Sunday through Saturday (with 1,
or Sunday, being the default)

Valid values for firstweekofyear are 0 through 4, where 0 means use the NLS
API setting, 1 (the default) means "Start with week in which January 1
occurs", 2 means "Start with the first week that has at least four days in
the new year." and 3 means "Start with first full week of the year".

These normally matter more when calculating week number, but I suppose it
could make a difference when a particular quarter ends and begins.
 
Those values are for firstdayofweek and firstweekofyear respectively.
Valid values for firstdayofweek are 0 through 7, where 0 means use the NLS
API setting, and 1 through 7 correspond to Sunday through Saturday (with 1,
or Sunday, being the default)...

Thanks for the info, Doug.

Regards,

Adetola.
 

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

Back
Top