I want to convert string cell values to Datetime cell values in the same column.
For ex : My column contains below data:
3/1/12 5:30 PM
i need to convert row 3 & 4 in datetime format and other’s in string format.
Thanks for your posting and considering Aspose.Cells.
Please use the following code to convert the string type into Excel date format.
Please see the screenshot and the output file generated by this code (attached).
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets;
Cell cell = worksheet.Cells[“A1”];
cell.PutValue(“2/1/12 4:59 PM”);
Style style = cell.GetStyle();
style.Number = 14; //try numbers from 14-22
There are two methods that depends on type of your requirements.
If your requirement is that you want to convert existing cell’s string
value to datetime, please use the code provided by me and make a bit change:
cell.PutValue(“2/1/12 4:59 PM”, true);
If your requirement is that you are loading data from CSV file, please use