## Using Builtin Functions And Statements

F,X ra You can use one of ten different constant values to specify the Interval argument and the type of date interval to return.

 INTERVAL VALUE DESCRIPTION yyyy year Only compares the year portion of both dates. 12/31/1999 and 1/1/2000 return a value of 1 year. q Quarter Divides year into four quarters and returns number of quarters between dates. m Month Only compares the month portion of both dates. 12/31/1999 and 1/1/2000 return a value of 1 month. y Day of Year Same results as using d. d Day Number of days between two dates. w Weekday Determines the day of the week of the first date, for instance, Wednesday, and then counts the number of Wednesdays between the dates. ww Week Relies on the value specified as the firstdayofweek argument to determine the number of weeks between two dates. h Hour If a time is not specified, uses midnight or 00:00:00. n Minute Number of minutes between two times. s Second Number of seconds between two times.

° To verify that both dates are valid, type If IsDate(Date1) And IsDate(Date2) Then replacing Datel and Date2 with the date variables.

 ■1 File Edit VI w Insert Formet Tools Data Window Help Type a question for help 5> « ! □ ci h a a I « a y * » & s • z mm " I Arial ||10 ~ B / Ü I =: a _ » C2 £ IG A B D E F G H I J 1 Start Time End Time Hours Worked 2 6.05 AM 6.12 PIV 10 8114 AM 5'23 P^ 9 4 9 12 AM 5 14 PM 6 5 7.34 AM 6.11 PM 11 8 755 AM 6'00 PM 11 7 S 9 II 11 12 n 14 Ii 18 17 18 19 21 21 22 2H 24 25 28 27 H 1 h |\ sheets /sheetl /( Sheet2 / sheets /Sheet4 \sheet3 / >l Ready

• Type Diff = DateDiff(interval, Date1, Date2), replacing Diff with the variable to receive the results of the function and Date1 and Date2 with the date variables.

— Switch to Excel and run the associated macro.

■ The DateDiff function compares the specified date and returns an interval value.

0 0