property Chart.FormatDate (Date as Date, Format as String) as String
Formats the date.

 TypeDescription 
   Date as Date A Date expression being formatted  
   Format as String A String expression that indicates the format of date.   
   String A String expression that indicates the formatted date.  
Use the FormatDate property to format a date. Use the NextDate property to increase or decrease a date based on a time unit. Use the FirstVisibleDate property to retrieve the first visible date. The DateFromPoint property gets the date from the cursor. Use the WeekDays property to specify the name of the days in the week. Use the MonthNames property to specify the name of the months in the year. Use the AMPM property to specify the name of the AM and PM indicators.

The Format parameter may include the following built-in tags:

The following tags are displayed based on the user's Regional and Language Options:

 

The following VB sample displays the next day as "Tue, May 31, 2005":

With G2antt1.Chart
    Debug.Print .FormatDate(.NextDate(.FirstVisibleDate, exDay, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>")
End With

The following C++ sample displays the next day as "Tue, May 31, 2005":

CChart chart = m_g2antt.GetChart();
DATE d = chart.GetNextDate( V2D( &chart.GetFirstVisibleDate() ), 4096, COleVariant( (long)1 ) );
CString strFormat = chart.GetFormatDate( d, "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>" );
OutputDebugString( strFormat );

where the V2D function converts a Variant expression to a DATE expression:

static DATE V2D( VARIANT* pvtDate )
{
	COleVariant vtDate;
	vtDate.ChangeType( VT_DATE, pvtDate );
	return V_DATE( &vtDate );
}

The following VB.NET sample displays the next day as "Tue, May 31, 2005":

With AxG2antt1.Chart
    Debug.Write(.FormatDate(.NextDate(.FirstVisibleDate, EXG2ANTTLib.UnitEnum.exDay, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>"))
End With

The following C# sample displays the next day as "Tue, May 31, 2005":

DateTime d = Convert.ToDateTime( axG2antt1.Chart.get_NextDate(Convert.ToDateTime(axG2antt1.Chart.FirstVisibleDate), EXG2ANTTLib.UnitEnum.exDay, 1) );
String strFormat = axG2antt1.Chart.get_FormatDate(d, "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>");
System.Diagnostics.Debug.Write(strFormat);

The following VFP sample displays the next day as "Tue, May 31, 2005":

With thisform.G2antt1.Chart
    wait window nowait .FormatDate(.NextDate(.FirstVisibleDate, 4096, 2), "<%ddd%>, <%mmmm%> <%d%>, <%yyyy%>")
EndWith


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.