简体   繁体   English

在表达式生成器 SSIS 2019 中将日期时间转换为字符串

[英]Convert datetime to string in expression builder SSIS 2019

I encountered a strange problem, moving from VS2015 to 2019. I've got a variable that is setup like this;我遇到了一个奇怪的问题,从 VS2015 移动到 2019。我有一个像这样设置的变量;

 SUBSTRING( (DT_STR,50, 1256)DATEADD("DAY",0,GETDATE()) , 1, 10)

This works perfectly in VS2015 but now when I tried to add the same code in a project, it returns "Cannot convert 'System.String' to 'System.DateTime'."这在 VS2015 中完美运行,但现在当我尝试在项目中添加相同的代码时,它返回“无法将 'System.String' 转换为 'System.DateTime'”。

Does anyone know anything about this?有人对这个有了解吗?

You can use c#您可以使用 c#

DateTime.Now.ToString("MM/dd/yyyy");

This link has all versions:此链接包含所有版本:

https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1 https://www.c-sharpcorner.com/blogs/date-and-time-format-in-c-sharp-programming1

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

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