Version

FormatDateRange(DateTime,DateTime,DateTime,Boolean,Boolean) Method

Returns a formatted string for a range of date times relative to a specific date.
Syntax
'Declaration
 
Public Overloads Overridable Function FormatDateRange( _
   ByVal start As Date, _
   ByVal end As Date, _
   ByVal relativeDate As Date, _
   ByVal includeStart As Boolean, _
   ByVal includeEnd As Boolean _
) As String
public virtual string FormatDateRange( 
   DateTime start,
   DateTime end,
   DateTime relativeDate,
   bool includeStart,
   bool includeEnd
)

Parameters

start
The start date/time.
end
The end date/time.
relativeDate
The relative date context
includeStart
If true will include the start time in the formatted string.
includeEnd
If true will include the end time in the formatted string.

Return Value

A formatted string.
Remarks

Note: If the start and end times are on the same day as the RelativeDate then only the time portion is returned in the formatted string. Otherwise the short day of week is also included and if the span between the start and end is 7 days or greater then the date is included as well.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also