Page 1 of 1

date issue

Posted: Wed Aug 28, 2013 8:25 am
by times29
Hi,
I am trying to convert varchar(8) to date and also doing DateOffsetByDays below is syntax but transformer not liking DateOffsetByDays

Thanks

IF IsValid("date", DateOffsetByDays(to_trans4.S_AAA, "%yyyy%mm%dd",1))
THEN StringToDate(to_trans4.S_AAA,"%yyyy%mm%dd")
ELSE StringToDate("99990101","%yyyy%mm%dd")

Posted: Wed Aug 28, 2013 8:39 am
by ArndW
The DateOffsetByDays() function needs a date input parameter, which wouldn't work if your source column isn't a valid date.

Try

Code: Select all

IF IsValid("date", to_trans4.S_AAA, "%yyyy%mm%dd")
THEN DateOffsetByDays(StringToDate(to_trans4.S_AAA, "%yyyy%mm%dd"),1)
ELSE StringToDate("99990101","%yyyy%mm%dd") 
(I might have a syntax error in there, but you should get the gist of it).

Posted: Wed Aug 28, 2013 9:02 am
by times29
can you please take premium content out

Posted: Thu Aug 29, 2013 2:05 am
by ArndW
times29 - I will in this case, since it isn't really complex premium content, but your userid shows as a "premium member" here on the forum.

Posted: Thu Aug 29, 2013 7:25 am
by chulett
ArndW wrote:your userid shows as a "premium member" here on the forum.
Unfortunately, all this means is that they were Premium at one point - not that they are currently. They've let it expire.

I've asked for this in the past to be changed to show one's current status but I don't think those kind of changes to the existing forum code are possible. :(