If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Crystal Reports > date formula problem...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-11, 13:08
pavansap pavansap is offline
Registered User
 
Join Date: Oct 2011
Posts: 8
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...
Reply With Quote
  #2 (permalink)  
Old 10-02-11, 20:40
mission mission is offline
Registered User
 
Join Date: Oct 2010
Posts: 44
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On