Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Add days to datetime and replace time with custom time

jwalantdvyas
5 - Atom

I want to add 2 days to my date and time field and replace time with custom value

 

if my

[datetime] = 2022-03-21 10:00

 

I want to add 2 days to it and change time to 13:00

[OutDateTime] = 2022-03-23 13:00

2 REPLIES 2
AkimasaKajitani
17 - Castor
17 - Castor

Hi @jwalantdvyas 

 

You can use DateTimeTrim expression to cutoff the hours and use the DateTimeAdd expression to add 61(24*2+13) hours.

 

DateTimeAdd(DateTimeTrim([datetime],"day"),61,"hour")

 

Qiu
21 - Polaris
21 - Polaris

@jwalantdvyas 
Since " 2022-03-21 10:00" is not a standard Date Time format, I am afraid we need to some parsing first.

0321-jwalantdvyas.PNG

Labels
Top Solution Authors