FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > DateTimeCellType Class : FormatString Property |
'Declaration Public Overrides Property FormatString As String
'Usage Dim instance As DateTimeCellType Dim value As String instance.FormatString = value value = instance.FormatString
public override string FormatString {get; set;}
Specify the format as a string using any of the valid format characters, some of which are listed here:
Format Specifier | Description | Example (all en-US culture) |
---|---|---|
d | Short date format | 1/29/2002 |
D | Long date pattern | Tuesday, January 29, 2002 |
f | Full date and time pattern (short time) | Tuesday, January 29, 2002 4:27 PM |
F | Full date and time pattern (long time) | Tuesday, January 29, 2002 4:27:42 PM |
g | General date and time pattern (short time) | 1/29/2002 4:27 PM |
G | General date and time pattern (long time) | 1/29/2002 4:27:42 PM |
m | Month day pattern | January 29 |
r | Internet protocol RFC1123 pattern | Tue, 29 Jan 2002 16:27:42 GMT |
s | Sortable date and time pattern | 2002-01-29T16:27:42 |
u | Universal sortable date and time pattern | 2002-01-29 16:27:42Z |
U | Universal sortable date and time pattern | Tuesday, January 29, 2002 9:27:42 PM |
y | Year month pattern | January, 2002 |
You can also specify custom date formats. For a complete list of format characters and more information on creating custom date formats, see Date and Time Format Strings in the Microsoft .NET Framework Developers Guide.
FarPoint.Web.Spread.DateTimeCellTypedatecell=new FarPoint.Web.Spread.DateTimeCellType(); datecell.ErrorMessage="Needadate!!!"; datecell.FormatString="d"; FpSpread1.Sheets[0].Cells[0,0].CellType=datecell; FpSpread1.Sheets[0].Cells[0,0].Value=System.DateTime.Now.ToOADate(); FpSpread1.Sheets[0].Columns[0].Width=175;
Dim datecell As New FarPoint.Web.Spread.DateTimeCellType() datecell.ErrorMessage="Needadate!!!" datecell.FormatString="d" FpSpread1.Sheets(0).Cells(0,0).CellType=datecell FpSpread1.Sheets(0).Cells(0,0).Value=System.DateTime.Now.ToOADate() FpSpread1.Sheets(0).Columns(0).Width=175
Target Platforms: Windows 7, Windows 8, Windows Vista, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6