Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    8

    Unanswered: date formula problem...

    hi

    this is pavan...i am new to crystal reports....i have a doubt..i tried to write a formula for a :

    members scheduled for an interview within 10 business days and i should exclude sundays in this...

    the formula is


    Select (DATEDIFF(day,b.startDate,b.Endadate) +1) - (DATEDIFF(wk,b.StartDate,b.Endadate)*2)
    - (CASE WHen DATENAME(dw,b.startdate)='SUNDAY' THen 1 else 0 end)
    - (CASE when DATENAME(dw,b.endadate)='SATURDAY' then 1 else 0 end)

    but the formula is not working...can anybody suggest me...

    thanks in advance...

  2. #2
    Join Date
    Oct 2010
    Posts
    46
    Quote Originally Posted by pavansap View Post
    members scheduled for an interview within 10 business days and i should exclude sundays in this...

    Select (DATEDIFF(day,b.startDate,b.Endadate) +1) - (DATEDIFF(wk,b.StartDate,b.Endadate)*2)
    - (CASE WHen DATENAME(dw,b.startdate)='SUNDAY' THen 1 else 0 end)
    - (CASE when DATENAME(dw,b.endadate)='SATURDAY' then 1 else 0 end)
    1. Check your syntax

    DateDiff

    DateDiff returns a number of time intervals between two specified dates

    Syntax:

    DateDiff (intervalType, startDateTime, endDateTime)
    DateDiff (intervalType, startDateTime, endDateTime, firstDayOfWeek)

    intervalType is a String expression that is the interval of time you use to calculate the difference between startDateTime and endDateTime.
    startDateTime is the first DateTime value used in calculating the difference.
    endDateTime is the second DateTime value used in calculating the difference.
    firstDayOfWeek is an optional constant specifying the first day of the week.

    Returns
    A Number value


    2. Elaborate on what you want to do

    Don't know why you are finding date difference for "members scheduled for an interview within 10 business days and i should exclude sundays in this". If you can explain what you want to do, maybe someone can help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •