How to convert “double” to “datetime” between Excel and c#

前端 未结 4 999
执笔经年
执笔经年 2021-01-23 22:10

I have a c# program which needs to create an excel object, and do some operations, here are parts of my code:

// c# code:

workSheet.Cells[1, 1] = \"=2012/9/20\         


        
4条回答
  •  孤独总比滥情好
    2021-01-23 23:02

    Dude, your excel value is not a date. Drop the equal sign at the beginning.

    Once you do that you will get a proper double value for your time (which can be converted via the OADate function). What your getting now is nonsense.

提交回复
热议问题