Re: Calculations

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Doug Robbins - Word MVP (dkr_at_NOmvpsSPAM.org)
Date: 04/22/04


Date: Thu, 22 Apr 2004 19:11:59 +1000

Check out the DateDiff function in the Visual Basic Help File

Returns a Variant (Long) specifying the number of time intervals between two
specified dates.

Syntax

DateDiff(interval, date1, date2[, firstdayofweek[, firstweekofyear]])

The DateDiff function syntax has these named arguments:

interval. String expression that is the interval of time you use to
calculate the difference between date1 and date2.
date1, date2 Variant (Date). Two dates you want to use in the calculation.

The interval argument has these settings:
Setting Description
yyyy Year
q Quarter
m Month
d Day
ww Week
h Hour
n Minute
s Second

-- 
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested.  Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"bsando" <bsando.153lmf@nospam.WordForums.com> wrote in message
news:bsando.153lmf@nospam.WordForums.com...
>
> OK.
>
> I have two labels (Label1 - Start date, Label2 - end date).
>
> On clicking these labels the date and time in automatically entered at
> a bookmark, That way no matter where the cursor is on the screen it
> will goto back to the bookmark and enter the date and time.
>
> What I want to do is have either a field or label etc that will
> automatically give the difference in time either in days, hours or
> minutes.
>
> I hope this helps.
>
> Thanks again
>
>
> ------------------------------------------------
> ~~ Message posted from http://www.WordForums.com/


Relevant Pages

  • Re: define-datatype and scope
    ... It looks like the identifier target is a top-level variable. ... ;target: illegal use of syntax in: target ... the datatype to be defined. ... the use of cases actually is a variant of the datatype. ...
    (comp.lang.scheme)
  • Re: Aggregating Date Data into Weeks and Quarters
    ... DateSerialReturns a Variant for a specified year, month, and day. ... Returns a Variant containing a whole number representing the day of the week. ... WeekdayName) Returns a string indicating the specified day of the week. ... MonthReturns a Variant specifying a whole number between 1 and 12, inclusive, representing the month of the year ...
    (microsoft.public.access.queries)
  • Re: Aggregating Date Data into Weeks and Quarters
    ... DateSerialReturns a Variant for a specified year, month, and day. ... Returns a Variant containing a whole number representing the day of the week. ... WeekdayName) Returns a string indicating the specified day of the week. ... MonthReturns a Variant specifying a whole number between 1 and 12, inclusive, representing the month of the year ...
    (microsoft.public.access.queries)
  • Re: Where is DateDiff function in Excel 2002 ?
    ... Returns a Variant specifying the number of time intervals between two ... The DateDiff function syntax has these named arguments: ... To calculate the number of days between date1 and date2, ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Getting at variant containing safe array from COM object?
    ... >I ended up solving it myself but with a somewhat different syntax. ... >>>I have a COM object which has a method which returns a variant which ... >>> object GetNextEvent() ... >>> Grant Schenck ...
    (microsoft.public.dotnet.languages.csharp)