cancel
Showing results for 
Search instead for 
Did you mean: 

Week Number from Monday

Former Member
0 Kudos

Hello,

I'm trying to get the week number displayed in a report by using the DateDiff function (tell me if this is wrong!)

If I use DateDiff ("ww", #4/06/2008#,#9/02/2008#, crMonday) I get the results I need.

But I need to use the report print date within this function

eg:

DateDiff ("ww", #4/06/2008#,##, crMonday) or DateDiff ("ww", #4/06/2008#,#(currentDate)#, crMonday)

However CR keeps throwing up an error about the time date literal not being understood.

Thanks in advance

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I need to pull a parameter field from the report to use as acalculation date.

Is this possable?

Former Member
0 Kudos

Ya change that currentdate to the datefield.

Regards

Jehanzeb

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Alpana,

I dont seem to be able to get the feild in a date format as I have to use ToText.

The report feild is extracted from a table in the DB via this formula

(right (ToText ({temp_days.day_date}, "0"),2) + "/" + mid (ToText ({temp_days.day_date},"0"),5,2) + "/" + left (ToText ({temp_days.day_date},"0"),4))

IS there a way around this???

Former Member
0 Kudos

I have tried DateDiff ("ww", CDate(2008,04,06), {?Date Parameter}, , crMonday), but CR throws up "Date Value required here in the formula editor.

Former Member
0 Kudos

Hi Philip,

Make sure that the Parameter {?Date Parameter} is of date type.

Regards,

Alpana

Former Member
0 Kudos

I needed to remove the # like

DateDiff ("ww", #4/06/2008#, CurrentDate, crMonday)

Former Member
0 Kudos

If you want to remove u2018#u2019 you can try below formulas instead:

DateDiff ("ww", CDate(2008,04,06), CDate(2008,09,02), crMonday)

OR

For Current date:

DateDiff ("ww", CDate(2008,04,06), CurrentDate, crMonday)

For database fields:

DateDiff ("ww", {Orders.Order Date}, {Orders.Required Date}, crMonday)

For Date Parameter:

DateDiff ("ww", CDate(2008,04,06), {?Date Parameter}, , crMonday)

Let me know if this suits to your requirement.

Regards,

Alpana