Forum Discussion
Applying a duration to DateTime
- 3 years ago
Hello again Anonymous
I got it now Sir. Instead of null, I just put the DateTime.From([Created]) after else.... Many thanks again. Cheers! 🍻
= Table.AddColumn( #"Changed Type1", "PHCreatedDateTime", each
if DateTime.From([Created]) > #datetime(2022,11,11,0,0,0)
then DateTime.From([Created]) + #duration(0,8,0,0) else DateTime.From([Created]), type datetime)
Hi rakeman23 - I you thinking along the right line but I think you need to remove "as datetime"
= Table.AddColumn( #"Changed Type1", "PHCreatedDateTime", each
if DateTime.From([Created]) > #datetime(2022,11,11,0,0,0)
then DateTime.From([Created]) + #duration(0,8,0,0)
else null
, type datetime)- rakeman233 years agoNew Member
Hi Anonymous
Thanks Sir... worked like a charm 🙂
Although the "null" at the end of the statement, made the dates null.. hehe.. Sorry, what I want is for the statement to do "nothing" instead of null so that it will preserve its value
Apologies for the confusion. What should I substitute to null? Many thanks again- rakeman233 years agoNew Member
Hello again Anonymous
I got it now Sir. Instead of null, I just put the DateTime.From([Created]) after else.... Many thanks again. Cheers! 🍻
= Table.AddColumn( #"Changed Type1", "PHCreatedDateTime", each
if DateTime.From([Created]) > #datetime(2022,11,11,0,0,0)
then DateTime.From([Created]) + #duration(0,8,0,0) else DateTime.From([Created]), type datetime)