Free Support Forum - aspose.com

Problem with DateDiff function

Hi,
I am trialling Aspose Cells (4.4.3.1) using Visual Studio 2005 and Windows XP.
I can't use function DateDiff althought it's been in the formula list which I have read in the documentation.
When I put this formula to the cells:

Dim AspWorkBook As New Aspose.Cells.Workbook
Dim AspWorkSheet As Aspose.Cells.Worksheet = AspWorkBook.Worksheets(0)
AspWorkSheet.Name = "MySheet"
AspWorkSheet.Cells("A1").Formula=DateDiff("3/2/2008","3/7/2008","d")
AspWorkBookCalculateFormula()
MessageBox.Show(AspWorkSheet.Cells("A1").Value)

, then it returns this error :
#Name?
Doesn't Aspose support this function ?

Regards,
Hau


Hi Hau,

No, it 's not in the list:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/supported-formulas-functions.html

But we may consider it and support it soon for your requirment.

Thank you.

Hi Hau,

It seems that DateDiff is not an Excel function. I don't find it in MS Excel help and if I input it in Excel I also get a "#NAME?" error.

To serve your need, I think there is a simpler way:

You can put datetime value in B1 and C1, and input "=B1-C1" formula in cell A1.

Hi Laurence.
I found DateDiff function name in Aspose help!, but in Excel it true name is DateDif (D1,D2,"d"),
I need this function to count an integer second, hour, month, year ..., value between two date parameter.
Best Regrads.
Hau.

Hi Hau,

Where do you find the DateDiff function in Aspose help? We don't find it.

Anyway, we will support this function soon. You will get a fix in the next week.

Hi Laurence,

I found DataDiff function at http://www.aspose.com/documentation/ssrs-rendering-extensions/aspose.cells-for-reporting-services/formula-list.html
You can try this link.
Moreover, DateDif is a Excel function ( not DateDiff ). You can test it in Excel :
=DATEDIF("4/2/2008","4/6/2008","d")
Althought it's not in Excel help.

Regards,
Hau

Hi Hau,

Please try this fix.

We have supported to set and calculate thie function.

We only support "Y","M" and "D" as Unit param value in calculating this function.