我同意@AlexanderVolok,看起来包的 LocalID 与英语不同,或者在操作系统区域设置中选择的日期时间文化信息不同。
(1) 使用条件更改月份名称?:
如果您可以更改这些属性,那么它可能会解决问题,否则您可以在数据流任务之前添加一个表达式任务,该任务使用条件运算符将日期转换为具有不同格式的字符串? :
,例如(假设您正在处理波兰月份名称) :
@[User::NewDataString] =
LEFT((DT_WSTR,50)@[User::ToDate],2) + "-" +
(SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "maj" ? "may" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "stycz" ? "Jan" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "lut" ? "feb" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "mar" ? "mar" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "maj" ? "may" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "czerw" ? "jun" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "lip" ? "jul" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "sierp" ? "aug" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "wrzes" ? "sep" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "pazdzier" ? "oct" :
SUBSTRING((DT_WSTR,50)@[User::ToDate], FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) + 1, FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",2) - FINDSTRING((DT_WSTR,50)@[User::ToDate],"-",1) - 1) == "listopad" ? "nov" : "dec" )
+ "-" + RIGHT((DT_WSTR,50)@[User::ToDate],4)
然后你应该将新变量作为参数传递。
(2) 更改数据格式为 yyyy-MM-dd
您还可以使用Expression Task将月份转换为数值,例如:
@[User::NewDateString] =
RIGHT((DT_WSTR,50)@[User::ToDate],4) + "-" +
RIGHT("0" + (DT_WSTR,50)DATEPART("mm", @[User::ToDate]),2) + "-" +
LEFT((DT_WSTR,50)@[User::ToDate],2)
参考