Back to Devexpress

CellValue.DateTimeValue Property

officefileapi-devexpress-dot-spreadsheet-dot-cellvalue-d8aa59e5.md

latest7.6 KB
Original Source

CellValue.DateTimeValue Property

Returns the date and time value that corresponds to the number contained in a cell.

Namespace : DevExpress.Spreadsheet

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

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
public DateTime DateTimeValue { get; }
vb
Public ReadOnly Property DateTimeValue As Date

Property Value

TypeDescription
DateTime

A DateTime object.

|

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 contains a number, the DateTimeValue property returns the DateTime object which specifies a date and time value represented by that number. The number itself is accessed via the CellValue.NumericValue property. To check whether a cell displays its numeric value as date and time, use the CellValue.IsDateTime or CellValue.Type property. To get a string that specifies a cell value as it is displayed, use the Cell.DisplayText property.

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 DateTimeValue 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.

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/CS/DataBindingToListExample/MyConverter.cs#L11

csharp
if (requiredType == typeof(DateTime))
    return value.DateTimeValue;
if (requiredType == typeof(Weather)) {

how-to-export-cell-range-to-a-datatable/CS/ExportToDataTableExample/Form1.cs#L172

csharp
}
result = String.Format("{0:MMMM-yyyy}",cellValue.DateTimeValue);
return converted;

spreadsheet-document-api-create-loan-amortization-schedule-within-blazor-server-app/CS/BlazorAppSpreadsheet/Code/DocumentGenerator.cs#L18

csharp
{
    get { return Sheet["E8"].Value.DateTimeValue; }
    set { Sheet["E8"].Value = value; }

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/CS/DataBindingToListExample/MyConverter.cs#L11

csharp
if (requiredType == typeof(DateTime))
    return value.DateTimeValue;
if (requiredType == typeof(Weather)) {

spreadsheet-document-api-data-binding/CS/SpreadsheetApiDataBinding/MyConverter.cs#L15

csharp
if (requiredType == typeof(DateTime))
    return value.DateTimeValue;
if (requiredType == typeof(Weather))

spreadsheet-document-api-export-worksheet-range-to-datatable/VB/ExportToDataTableWorkbookExample/MyConverter.vb#L26

vb
End If
result = String.Format("{0:MMMM-yyyy}", cellValue.DateTimeValue)
Return converted

how-to-bind-a-worksheet-to-a-generic-list-or-a-bindinglist-data-source/VB/DataBindingToListExample/MyConverter.vb#L13

vb
If requiredType Is GetType(Date) Then
    Return value.DateTimeValue
End If

how-to-export-cell-range-to-a-datatable/VB/ExportToDataTableExample/Form1.vb#L163

vb
result = String.Format("{0:MMMM-yyyy}", cellValue.DateTimeValue)
Return converted

wpf-spreadsheet-bind-a-worksheet-to-generic-list-or-bindinglist-data-source/VB/DataBindingToListExample/MyConverter.vb#L13

vb
If requiredType Is GetType(Date) Then
    Return value.DateTimeValue
End If

spreadsheet-document-api-data-binding/VB/SpreadsheetApiDataBinding/MyConverter.vb#L11

vb
If requiredType Is GetType(Date) Then
    Return value.DateTimeValue
End If

See Also

IsDateTime

BooleanValue

NumericValue

TextValue

ErrorValue

Cell Data Types

Dates and Times in Cells

CellValue Class

CellValue Members

DevExpress.Spreadsheet Namespace