I've been struggling with this issue for some time now. I know Excel uses number for dates.
How do I know if a double inside the excel is supposed to be a datetime or not? When I do a GetFormat() the format string is always empty, not something like "yyyy-mm-dd".
The docs says that converting from double to dates can be done using a helper function. Can somebody help me solve my problem?
To be specific: Is there a way to get the cell format in Flexcel? And what's the best way to determine if a double is presented as a datetime?
I've got the cell format working. I made a mistake when adding cells to my List of rows. I forgot to do a GetFormat() when creating a new CellValue.
I'm currently checking if a cell value is a date by reading the cell format string (for example: dd/mm/yyyy). If the format contains 'yy' or 'mm' I know it's supposed to be a date.
Is this the right way to check if the cell format is a date format?
Sorry for the delay, this week I have very little access to a very crippled internet.
About doubles/dates, you indeed need to know if the format includes a date or not. Checking for yy or similar might work, but it might also fail in other cases, like " "yy" 0.000"
the recommended way to do it is: (from the "Reading Files" demo: Demo\Modules\10.API\20.Reading Files)
TFlxNumberFormat.FormatValue does a real parsing of the format and returns "HasDate" or "HasTime" if it actually has it. But checking for "yy" will mostly work too if you prefer it.