The specified value "2019-1-2" does not conform to the required format, "yyyy-MM-dd"


问题:

在cshtml中转换的日期格式错误,前端报错:The specified value "2019-1-2" does not conform to the required format, "yyyy-MM-dd"

 

导致原因:

由于时间格式没有完全匹配,"yyyy-MM-dd"应该对应"2019-01-02"

 

修改代码:

string.Format("{0:yyyy-MM-dd}", DateTime.Now);

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM