Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
Alteryx is here to help you solve your biggest data challenges. Read about the new Virtual Solution Center here.

Formula Tool - Date conversion addition

Highlighted
5 - Atom

Hi,

 

I am trying to add a column (Double data type) of values to a date column that is a V_String data type. When I try converting the string to date format, it changes all values to NULL. The date format and example of column value are listed below:


RECEIVE_DATE
17-NOV-16

 

POSTPROCESSING_LEAD_TIME
30

 

Thank you for any suggestions!

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Hi @jkope404 ,

 

if you want to convert the date from string data type to a date data type, you should use the function DATETIMEPARSE.

DateTimeParse([Receive_Date], '%d-%b-%y') should work for the format you want to convert, and the data type has
to be defined as "date" (double data type is only suitable for numeric data).

To add the value in field [POSTPROCESSING_LEAD_TIME] you can use DateTimeAdd, so complete formula would be:

DateTimeAdd(DateTimeParse([Receive_Date], '%d-%b-%y'), [POSTPROCESSING_LEAD_TIME], 'days')

If you need the date format from your input data, you can use DateTimeFormat - but this will result in a string field.

 

Does this help?

 

Best,

 

Roland 

Highlighted
Alteryx
Alteryx

Hey @jkope404 

 

You can do that datetime add pretty easily in a formula, you'll just have to make sure your date field is correctly formatted for Alteryx to work with it as a date. You can do this with a formula as shown above or within a DateTime tool.

 

Example attached 

 

date_add_days.PNG

Labels