Advent of Code is now back for a limited time only! Complete as many challenges as you can to earn those badges you may have missed in December. Learn more about how to participate here!
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