Why does DateTime.Now.TimeOfDay.ToString(“HH:mm:ss.ffffff”) throw FormatException?

前端 未结 2 1363
萌比男神i
萌比男神i 2021-01-07 23:00

I\'m having a similar problem with FormatException being thrown. My code is simply:

void Orders_OnSubmit()
{
   DateTime CurrentTime = DateTime.Now;
   rtbAd         


        
2条回答
  •  长发绾君心
    2021-01-07 23:27

    There's no need to explicitly access the Date and TimeOfDay properties of the DateTime instance. You can simplify your code like so:

    rtbAdd(String.Format("Submitted on {0:MM/dd/yyyy} at {0:HH:mm:ss.ffffff}", DateTime.Now));
    

提交回复
热议问题