Hi,
I wrote a plugin(early bound).
I have a dateTime field ,he is read only and I want that his value
will be DateTime.Now.Date-CreatedOn.value.Date .
How can I do it?
thanks!!
*This post is locked for comments
If you're subtracting two dates, you end up with a TimeSpan object. You can get the number of days from a timespan, but you can't express that a years/months/days because the number of months depends on the day you start counting.
If you want to subtract two dates in the plugins and save the difference in days, it would be something like:
TimeSpan difference = DateTime.Now - entity["createdon"].Value; entity["my_field"] = difference.Days.ToString();
Hope this helps! I'd appreciate if you would mark this as a Verified answer.
Thanks,
Aiden
yes,
I want to set current date minus myEntity.CreatedOn.value.Date.
thanks!
Do you want to set current date to some field ??
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Andrés Arias as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Aric Levin - MVP 2 Moderator
MA-04060624-0 1