問題:
How do I retrieve a date from SQL Server in YYYY-MM-DD
format?如何以YYYY-MM-DD
格式從 SQL Server 檢索日期? I need this to work with SQL Server 2000 and up.我需要它與 SQL Server 2000 及更高版本一起使用。 Is there a simple way to perform this in SQL Server or would it be easier to convert it programmatically after I retrieve the result set?是否有一種簡單的方法可以在 SQL Server 中執行此操作,或者在檢索結果集後以編程方式轉換它是否更容易?
I've read the CAST and CONVERT on Microsoft Technet, but the format I want isn't listed and changing the date format isn't an option.我已閱讀 Microsoft Technet 上的CAST 和 CONVERT ,但未列出我想要的格式,並且無法更改日期格式。
解決方案:
參考一: https://en.stackoom.com/question/3jQr參考二: https://stackoom.com/question/3jQr