Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in DatePart function

Status
Not open for further replies.

vxxv

Programmer
Jan 23, 2004
32
PT
Hello,

I'm working with CR 8.5 and I use a formula that retrieves the week number in a field of the type date, and the formula is like this:
DatePart ("ww",{MONTHDAYS.DAY})

I´m processing the CR through a form in BasicScript and it gives me an error in that formula. Meaning that, if I put the formula in the CR it produces an error if I don't put it it works fine.
I've searched in the CR Web page, in the Support page, and they talked about one U2ldate.dll and some formula that looks like this: DatePart ("ww", d, crMonday, crFirstFourDays)
Then I tried that other formula and it still didn't work, and I realised that I don't have that U2ldate.dll application extension.
Now, I'm all in blank. I dont know if the cause of the error is that the application is missing or if the formula is not like that.

Could someone help me with this.

My regards,
Jaime
 
DatePart has two optional arguments: first day of week, and first week of year. When you use:

datepart("ww",{table.date})

...the defaults for these two arguments are used: crSunday, which can also be expressed as 1, for the first day of the week, and crFirstJan1, the week in which January 1 occurs, as the first week of the year. If you want to set these to something else, you add the arguments, as in:

datepart("ww", {table.date}, crTuesday, crFirstFullWeek)

Check out DatePart in the Help files for more information on the constants available.

I cannot help you regarding the dll (which you say might be missing?), but the name of your date field looks like it should be a day of the month number, instead of a date. Are you sure you are correct that this field is of date datatype? Sorry for second guessing--it just looks like an odd name for a date...

-LB
 
Thanks for the response, I'm going to work on it.
The field MONTHDAYS.DAY in fact represents a date (it's a date datatype). I agree that it's not a good name for specifying this field, but it was not me that built the table. So I must restrict to the names provided by the database administrator.

Jaime
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top