DiffWeeks

This function uses the whole interval method to calculate the difference in weeks. If you need to calculate the number of weeks using the boundary crossing method, use the DateDiffSQL function instead.

See Date Functions for more information about using the whole interval method versus using the boundary crossing method.

Syntax

DiffWeeks(startDateTime, endStartTime, timeZone)

Enabled For

For a description of the business object categories, see Notes on "Enabled For".

Business Object Category Yes/No
Business Rules: Before-Save Rules Yes
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) Yes
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) Yes
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) Yes
Business Rules: Editing Rules Yes
Business Rules: Initialization Rules Yes
Business Rules: Read Only Rules Yes
Business Rules: Required Rules Yes
Business Rules: Validation Rules Yes
Client Expressions Yes
Object Permissions Yes
Services Yes
LDAP Yes
Mobile Yes
Quick Actions (except UI Quick Actions) Yes
UI Quick Actions Yes
Reports Yes
Search/Dashboard without field references Yes
Search/Dashboard with field references Yes

Parameter

Parameter Description
startDateTime

The start date and time to be compared.

endDateTime The end date and time to be compared.
timeZone

(Optional) The time zone, in IANA format.

NOTE: This parameter is optional.  If you specify a time zone, the application assigns that time zone to both the startDateTime and endDateTime parameters. If you do not specify a time zone, the application uses the time zone associated with the current session.

Return Value

Number value.

If the value of the startDateTime parameter is earlier than the value of the endDateTime parameter, the returned value is positive. If the value of the startDateTime parameter is later than the value of the endDateTime parameter, the returned value is negative.

Example

See the DiffDays function for an example.