We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

NOW() method return wrong date

Hello,

when i have the formula (in Excel) =INT(NOW()+0.5) to set the current day, Aspose return me the value 2020-3-17 instead of 2020-3-27 (which is the current day as i’m wrinting these lines).

Dunno why it returns me the date with 10 days in the past.

Any idea about this ?

thanks for the help.

@stephanie.dechamplain,
Thank you for your query.
I have tried to reproduce this issue with one of my sample file having the same formula. I am afraid that issue is not reproduced and today’s date is displayed. Could you please share your sample console application, template file and program output with us for our analysis. We will try to reproduce this scenario here and provide assistance accordingly.

Workbook objWB = new Workbook(path + "Book1.xlsx");
objWB.CalculateFormula();
Console.WriteLine(objWB.Worksheets[0].Cells["A1"].Value);

var result = objWB.Worksheets[0].CalculateFormula("=TEXT((INT(NOW()+0.5)),\"m/d/yyyy\")");
Console.WriteLine(result);

Book1.xlsx.zip (6.6 KB)

Hello there ! Thanks for the fast answer ! I did try with your exemple and it actually worked. It made me notice that i did not call the function CalculateFormula() on my worksheet. Tested it and it made everything work fine.

Thanks for the help, seems to be working now.
Have a nice day.

@stephanie.dechamplain,

Yes, it is always better to call the CalculateFormula method first if you need to get the calculated results of the formulas in the worksheet/workbook.