简体   繁体   English

如何将日期格式更改为字符串

[英]How to change the date format to string

Using SqlServer 2000 and VB6 使用SqlServer 2000和VB6

Table

Dates

10/10/2009 (dd/mm/yyyy)
11/10/2009
....
....

Dates Column Data type is datetime 日期列数据类型为datetime

I want to change the format to string like this '20091010', '20091011' 我想将格式更改为字符串,例如“ 20091010”,“ 20091011”

Expected Output 预期产量

Dates

20091010 (yyyymmdd)
20091011
....
....

How to make a query for the above condition 如何查询上述条件

Need Query Help 需要查询帮助

This 这个

SELECT CONVERT(CHAR(8), YOUR_DATE_COLUMN_NAME, 112) from TABLE_NAME

Should do the trick 应该做的把戏

You can substitue 112 for other format from here 您可以从此处用112替换其他格式

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM