Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

DateTimeAdd used in formula causes time to disappear

jenv20032000x
7 - Meteor

Hello Experts!  Thank you in advance for your valuable time.  I am trying to create an appended date and time field.  When I add DateTimeAdd to the formula, my time disappears.  I've tried each field on it's own and they populate as expected. I have three different fields and they all work as expected, except, when I add DateTimeAdd.   What am I doing wrong?  The correct date and time in my attached examples should be 2020-04-03 01:00:00.

5 REPLIES 5
Jonathan-Sherman
15 - Aurora
15 - Aurora

Hi @jenv20032000x,

 

This formula should work for you:

 

DateTimeAdd(DateTimeAdd(DateTimeNow(),1,'day'),1,'hour')

 

image.png

 

If this solves your issue please mark the answer as correct, if not let me know! I've attached my workflow for you to download if needed.

 

Regards,

Jonathan

OllieClarke
15 - Aurora
15 - Aurora

HI @jenv20032000x try this:

OllieClarke_0-1585827026893.png

 

it's because datetimeadd creates a date time, so to add your time string you need to ignore the time part of the date time

 

jenv20032000x
7 - Meteor

Thank you both so much!  Both solutions worked.  I greatly appreciate the assist.

DemandEngineer
8 - Asteroid

Hello,

I'm having problems with the DateTimeAdd when using in the formula tool. I assume my field is formated correctly because I can take that field and another time field and do a DateTimeDiff...

 

I tried this but it only generated Nulls... not sure what I'm doing wrong. Note: the data is Time only.

 

DateTimeAdd([Sunset_Out], 12, "hours")

 

 

I ended up having to do this which seems like a workaround... and I got the result I wanted but I want to know why DateTimeAdd didn't work... please help me understand so I know how to use it in the future.

 

ToString((ToNumber(Substring([Sunset_Out],0,2))+12), 0)+Substring([Sunset_Out],2,6)

 

Data in Formula ToolData in Formula Tool

HeatherLPesch
5 - Atom

I had the same issue when working on challenge 68. I'm wondering if it is because it is only hh:mm:ss rather than the full date??? Annoying because it seems like it should work.

Labels