DateDiff funtion - what is interval?

D

davegb

Ashamed to admit I haven't used the funcions in calculable fields in a
long time. Trying to use the DateDiff function, and the first parameter
is "interval", which the help screen tells me is "interval". Thaks for
all your support, Microsoft! I thought it might be time intervals like
days, but it won't take d or day. So what does it want here?
Thanks for your help.
 
J

JackD

Here is what I get when I click the help button and then on available
functions/Date/time functions:

-------snip-----
DateDiff
Returns a Variant (Long) specifying the number of time intervals between two
specified dates.
Syntax
DateDiff( interval, date1, date2[, firstdayofweek[, firstweekofyear]] )
interval Required; string expression that is the interval of time you use
to calculate the difference between date1 and date2.
date1, date2 Required; Variant (Date). Two dates you want to use in the
calculation.
firstdayofweek Optional; a constant that specifies the first day of the
week. If not specified, Sunday is assumed.
firstweekofyear Optional; a constant that specifies the first week of the
year. If not specified, the first week is assumed to be the week in which
January 1 occurs.
------snip-------

The key thing here is where it says "string expression"

so enter something like:

DateDiff("d",[Start], {Finish])

and it works just fine. Just make sure your string is between quotation
marks like a good little string and you won't have any problems.

I generally avoid DateDiff and use ProjDateDiff instead.
Most of the time it fits my needs better since it takes into account the
project calendar. It always returns results in working minutes so you need
to convert if you want hours/days/ whatever.
 
S

Steve House [MVP]

It is the time interval - try "d" in quotes (or is it "dd" ? senior citizen
moment here).
 
J

JLB

From VB help for datediff (which, I strongly suspect, is the model for
pjdatediff):

yyyy Year
q Quarter
m Month
y Day of year
d Day
w Weekday
ww Week
h Hour
n Minute
s Second
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top