Calculating number Days using today()/now() - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Calculating number Days using today()/now()

Last post 05-21-2024 09:58 AM by Froman. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 05-21-2024 09:03 AM

    Calculating number Days using today()/now()

    I'm trying to create a formula that is today - "assigned date" to return the number of days from assigned to today. from my understanding I should be able to use the formula "translate(now(), "-", "") - translate(AssignedDate, "-", "")" but I keep getting a "nan" error. what am I doing wrong? is it possible to do this in infopath?
  • 05-21-2024 09:23 AM In reply to

    Re: Calculating number Days using today()/now()

    It is surprisingly hard to do this. Here's a post with a sample approach: https://ankursharepoint.wordpress.com/2011/05/23/calculate-the-difference-between-two-date-picker-controls-in-infopath-using-rules-and-formulas-no-code/
    Hilary Stoupa

  • 05-21-2024 09:35 AM In reply to

    Re: Calculating number Days using today()/now()

    thanks so much Hilary, I'll take a look at this right away. although I have an added wrinkle and I'm not sure if it will make things easier or impossible. I tried to edit my post but I don't think it worked. What I am trying to do is to present this information in a form from another list, so I am using a query to grab dates from my main list and present it in a repeating table, so i am not saving this or picking dates. I'm pulling saved dates and trying to run them through a formula. I attached my form (very simple) but it shows essentially what I'm trying to do.
  • 05-21-2024 09:53 AM In reply to

    Re: Calculating number Days using today()/now()

    The forum server is being a bit of a slow poke - I may try to restart it tonight or tomorrow. It may have eaten your edit. :-) If your data is coming from another list, what about just adding a column to that list with the date diff? I know SharePoint won't dynamically update that if calculated, but perhaps a scheduled workflow of some kind could do the trick? If you are using SharePoint Online, I'd just use a scheduled Flow to update the column and have it run every day at midnight or something... not sure what the options are with SharePoint Designer.
    Hilary Stoupa

  • 05-21-2024 09:58 AM In reply to

    Re: Calculating number Days using today()/now()

    I thought about using designer, but as I have little control over the server and designer has a hard time scheduling flows, it can only run on the weekend (complex situation) I actually managed to figure a way to do this, my formula is way overly complicated, but I think it's going to work. Thanks so much for your reply, you got me on the right path!!! (substring(today(), 9, 2) + ((153 * (substring(today(), 6, 2) + 12 * ((14 - substring(today(), 6, 2)) / 12) - 3) + 2) / 5) + 365 * (substring(today(), 1, 4) + 4800 - ((14 - substring(today(), 6, 2)) / 12)) + ((substring(today(), 1, 4) + 4800 - ((14 - substring(today(), 6, 2)) / 12)) / 4) - 32083) - (substring(AssignedDate, 9, 2) + ((153 * (substring(AssignedDate, 6, 2) + 12 * ((14 - substring(AssignedDate, 6, 2)) / 12) - 3) + 2) / 5) + 365 * (substring(AssignedDate, 1, 4) + 4800 - ((14 - substring(AssignedDate, 6, 2)) / 12)) + ((substring(AssignedDate, 1, 4) + 4800 - ((14 - substring(AssignedDate, 6, 2)) / 12)) / 4) - 32083)
Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.