July 21, 2016 at 8:59 am
hi
I need date format somethimng like this YYYMMDD HH:MM:SS
i wrote expression like below but issue is i am appending this date to filename and its throwing errors due to ":" colons. Can anyone rewrite this expression to avoid errors?
(DT_STR,4,1252) datepart("yyyy", getdate())
+ (DT_STR,2,1252) datepart("mm", getdate())
+ (DT_STR,2,1252) datepart("dd", getdate())
+" "
+Right("0" + (DT_STR,2,1252) DatePart("hh",getdate()),2) +":"
+ Right("0" + (DT_STR,2,1252) DatePart("mi",getdate()),2) +":"
+ Right("0" + (DT_STR,4,1252) DatePart("ss",getdate()),2)
July 21, 2016 at 9:08 am
July 21, 2016 at 9:24 am
if i remove the colons i get this format:
2016721 102358 but requirment is to have hh:mm:ss
July 21, 2016 at 9:28 am
komal145 (7/21/2016)
if i remove the colons i get this format:2016721 102358 but requirment is to have hh:mm:ss
A filename can't contain colons.
August 5, 2016 at 5:14 am
Why not use a script task. Using vb.net this would be
Dim MyDate as string
MyDate = date.now().ToString("yyyyMMdd HH:mm:ss")
Then pass this out to a package variable
Dts.Variables("User::VariableName").Value = MyDate
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply