I want to convert a date like 22Feb11 which is varchar in source to date datatype in format YYYYMMDD ..I know I must use stringtodate ...
but what formating i shud use?? I have used
StringToDate(DSLink100.PalanedDeliveryDate,"%yyyy-%mm-%dd")
but its not working..
convert string to date
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 94
- Joined: Sun Jul 18, 2010 11:35 pm
I don't really think that "22Feb11" is understood by DS compiler.
StringToDate is NOT magic function, it coverts datatype and help you a bit with your format if it's related to some kind of standard, data standard format I mean.
So what to do? Reformat the string 22Feb11 to something more understandable to a compiler first, then use that function.
StringToDate is NOT magic function, it coverts datatype and help you a bit with your format if it's related to some kind of standard, data standard format I mean.
So what to do? Reformat the string 22Feb11 to something more understandable to a compiler first, then use that function.
Not only thoughts, but a little bit of experience.
In other words, the 'mask' you use in StringToDate() must match the incoming string's format. And that will get you a Date which has no external format. If you really need something in an external format like YYYYMMDD you'll need to also use DateToString() afterwards, again with the appropriate mask.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers