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