Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
RÉSOLU

Using datetimeadd() functions on HH:mm:ss format

Rwebber1991
Astéroïde

I am having trouble using the DateTimeAdd() function to add minutes to a date field when the data is in HH:mm:ss format, using the function only produces null values. When I use a full datetime format (YYYY-MM-DD HH:mm:ss) I can add minutes no problem. I have included a workflow where both formats are attempted to use the DateTimeAdd() function. Please let me know if you have any suggestions. 

 

Rwebber1991_1-1651870350949.png

 

4 RÉPONSES 4
CathyS_Slalom
Comète

Hi @Rwebber1991, that's because the DateTimeAdd function can only take date or datetime as input. To work around this, you can mock up a date first and then extract the added time only. 

 

For example:

cathyshi525_0-1651871847775.png

 

rfoster7
Boule de feu

Yeah, if you look at your HH:MI:SS field type in the select tool you'll see that its vstring, not datetime. You can only use datetimeadd on datetime data. When you use the dateparse tool you end up converting it from string to time. You still can't use datetimeadd on time, only on datetime. 

 

I would append a date onto your time, force it into datetime, and then use datetimeadd to add your seconds, then convert back to time.  Something like the attached. 

 

image.png

 

 

Rwebber1991
Astéroïde

Okay yeah this is what I was thinking. I wasn't sure if there was a way to add to just the time variable. Thanks.

Rwebber1991
Astéroïde

This is helpful thank you.

Sondage
We’re dying to get your help in determining what the new profile picture frame should be this Halloween. Cast your vote and help us haunt the Community with the best spooky character.
Don’t ghost us—pick your favorite now!
Étiquettes