Convert Char field to Date field and remove time from the field name

社会主义新天地 提交于 2020-02-03 03:13:29

问题


I am using the following command to remove the time from the date field:

SELECT CONVERT(VARCHAR(10), FieldValue,101) FROM table 

FieldValue is a char field, but has a date i.e. 2012-09-30 00:00:00

The above command returns 2012-09-30, but I need it to be 09/30/2012

Any idea what I need to add to the command?


回答1:


Yes, you should use format()

format(Fields!YourField.Value, "MM/dd/yyyy")


来源:https://stackoverflow.com/questions/14281221/convert-char-field-to-date-field-and-remove-time-from-the-field-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!