ENDOFWEEK

Returns the end date of the week for the date passed to the function. If the date passed to the function is in wrong format then returns the system’s date. The time returned is 11:59:59 PM.

Syntax

= ENDOFWEEK(valueDate)

Parameters

valueDate

A date time value whose end date of the week is to be determined. The value can contain DateTime as a string (e.g. “02/19/2009 14:30:30.3”, "2009-02-19 14:30:30.3", "19 Feb 2009 2:30:30.3 PM ", "Thu, 19 Feb 2009”) or as a DateTime object.

Return Type

DateTime. The function returns a Microsoft .NET DateTime object.  Any properties or member functions of the DateTime object can also be accessed or used in formulas.

Examples

Example

Returns

= ENDOFWEEK(“02/19/2009 14:30:30.3”)

2/21/2009 11:59:59 PM

= ENDOFWEEK ("2009-02-19 14:30:30.3")

2/21/2009 11:59:59 PM

= ENDOFWEEK(“abcd”)

The end of the week for the system date.

= ENDOFWEEK(ShippedDate)

The end of the week for the value of ShippedDate. If any entries are NULL then returns the start of the week for the system’s date.

= ENDOFWEEK(“02/19/2009”).Day

The day for end of the week for the given date.

= ENDOFWEEK(“02/19/2009”).AddDays(-7)

The date and time for the end of the week previous to the specified date.

= ENDOFWEEK(“02/19/2009”).AddDays(-7).Day

The day for the end of the week previous to the specified date.

Reference

http://msdn.microsoft.com/en-us/library/system.datetime_members(VS.71).aspx