How to represent a DateTime in Excel

后端 未结 8 1568
梦如初夏
梦如初夏 2020-11-28 07:12

What is the best way of representing a DateTime in Excel? We use Syncfusions Essential XlsIO to output values to an Excel document which works great. But I can\

相关标签:
8条回答
  • 2020-11-28 08:01

    You can set date time values to a cell in XlsIO using one of these options

    sheet.Range["A1"].Value2 = DateTime.Now;
    sheet.Range["A1"].NumberFormat = "dd/mm/yyyy";
    
    sheet.Range["A2"].DateTime = DateTime.Now;
    sheet.Range["A2"].NumberFormat = "[$-409]d-mmm-yy;@";
    

    You can find more information here.

    0 讨论(0)
  • 2020-11-28 08:05

    If, like me, you can't find a datetime under date or time in the format dialog, you should be able to find it in 'Custom'.

    I just selected 'dd/mm/yyyy hh:mm' from 'Custom' and am happy with the results.

    0 讨论(0)
提交回复
热议问题