I created a ampscript that goes inside a landing page in salesforce exacttarget:
SET @dtenvio = IsNullDefault(QUERYPARAMETER("dtenvio"), Now(1))
var @data
set @data = v(@dtenvio)
set @data = FormatDate(v(@data), "YYYY-MM-DD")
set @year = DatePart(v(@data),"y")
set @year2 = multiply(v(@year),10000)
set @month = DatePart(v(@data),"m")
set @month2 = multiply(v(@month),100)
set @day = DatePart(v(@data),"d")
set @data_envio = add(v(@Year2),v(@month2))
set @data_envio = add(v(@data_envio ),v(@day))
The thing is a get an error only after que user submits a form: "Invalid value specified for function parameter. Function Name: DatePart Ordinal 1"
I tried outputing the results of all the dateparts functions and they were all okey
%%=v(year)=%% results in 2017 for example. All the resulting code works fine but when the user submits the form the error occurs even though the code was already executed with no problems. Does anyone know what might be happening?