Skip to Content
avatar image
Former Member

Week Number from Monday

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 03, 2008 at 09:16 AM

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

    Is this possable?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 08:47 AM

    I needed to remove the # like

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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • avatar image
    Former Member
    Sep 03, 2008 at 11:16 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 03, 2008 at 11:40 AM

    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???

    Add comment
    10|10000 characters needed characters exceeded