Macro for Datetime calculation

Wei Wang asked on April 9, 2020 21:06


I need to write macro to calculate some datetime fields but I found this is strange. I can use AddDays function to the below CurrentUser.LastLogon field and this seems working correctly: {% CurrentUser.LastLogon.AddDays(90) #%}

But then when I need to use the same AddDays function to calculate another datetime field UserPasswordLastChanged it didn't work anymore. I guess this is a custom field so how do i get around it to make it work? {% CurrentUser.UserSettings.ItemsAsFields.UserPasswordLastChanged.AddDays(90) #%}

thank you Wei Wang

Correct Answer

Peter Mogilnitski answered on April 10, 2020 02:11

try this:

{% CurrentUser.UserSettings.ItemsAsFields.UserPasswordLastChanged[0].AddDays(90) #%}

0 votesVote for this answer Unmark Correct answer

Recent Answers

Trevor Fayas answered on April 9, 2020 22:45

Can you try doing a {% Convert.ToDateTime(CurrentUser.UserSettings.ItemsAsFields.UserPasswordLastChanged).AddDays(90) #%} ?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.