Back to Devexpress

CellValue.IsDateTime Property

officefileapi-devexpress-dot-spreadsheet-dot-cellvalue-3fcf05c0.md

latest5.8 KB
Original Source

CellValue.IsDateTime Property

Gets whether the cell’s numeric value is displayed as date and time.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public bool IsDateTime { get; }
vb
Public ReadOnly Property IsDateTime As Boolean

Property Value

TypeDescription
Boolean

true , if the number contained in a cell is displayed as data and time; otherwise, false

|

Remarks

Dates and times are stored in cells as numbers that are displayed according to the applied date and time formats. So, if a cell displays a date and time value, both IsDateTime and CellValue.IsNumeric properties return true.

You can also use the CellValue.Type property to obtain the cell value type. This property returns CellValueType.DateTime, if a cell value is a number that is displayed as data and time.

The CellValue.NumericValue property returns the number contained in a cell, and the CellValue.DateTimeValue property returns the DateTime object, which specifies the date and time value represented by this number.

For more information on cell values, refer to the Cell Data Types and Dates and Times in Cells documents.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsDateTime property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

spreadsheet-document-api-use-worksheet-table-as-data-source/CS/SpreadsheetDocumentServerAsDataSourceExample/MyColumnDetector.cs#L23

csharp
if (value.IsBoolean) return typeof(bool);
if (value.IsDateTime) return typeof(DateTime);
if (value.IsNumeric) return typeof(double);

winforms-spreadsheet-use-cell-range-as-data-source/CS/RangeDataSource/MyColumnDetector.cs#L23

csharp
if (value.IsBoolean) return typeof(bool);
if (value.IsDateTime) return typeof(DateTime);
if (value.IsNumeric) return typeof(double);

spreadsheet-document-api-use-worksheet-table-as-data-source/VB/SpreadsheetDocumentServerAsDataSourceExample/MyColumnDetector.vb#L26

vb
End If
If value.IsDateTime Then
    Return GetType(Date)

winforms-spreadsheet-use-cell-range-as-data-source/VB/RangeDataSource/MyColumnDetector.vb#L21

vb
If value.IsBoolean Then Return GetType(Boolean)
If value.IsDateTime Then Return GetType(Date)
If value.IsNumeric Then Return GetType(Double)

spreadsheet-document-api-examples-part1/VB/SpreadsheetExamples/SpreadsheetActions/DocumentPropertiesActions.vb#L77

vb
worksheet(rowIndex, 2).Value = workbook.DocumentProperties.Custom(propertyName)
If worksheet(rowIndex, 2).Value.IsDateTime Then worksheet(rowIndex, 2).NumberFormat = "[$-409]m/d/yyyy h:mm AM/PM"
rowIndex += 1

See Also

IsNumeric

IsEmpty

IsBoolean

IsText

IsError

Type

CellValue Class

CellValue Members

DevExpress.Spreadsheet Namespace