# Discussions

View Only

## How can you subtract a date field from the current day's date?

• #### 1.  How can you subtract a date field from the current day's date?

Posted 02-28-2014 20:16

For example. Date field is 1/1/14. Todays date is 1/15/14. Answer = 15 days.

• #### 2.  RE: How can you subtract a date field from the current day's date?

Posted 02-28-2014 20:25
if you have a formula numeric field, the formula would be

ToDays(Today()-[date field])

The today() function returns today's date. The similarly (but different) named function "ToDays ( )" converts a duration result to the number of days, i.e. a number.

• #### 3.  RE: How can you subtract a date field from the current day's date?

Posted 02-07-2019 01:08
Instead of using a date field could I use a sample status? I wanna see how I can check how many day a sample is sitting in a certain status
_

• #### 4.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 16:06
Tried to use this but it says the minus sign does that work for date or datetime field types.

• #### 5.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 16:27
if the date field is a date/time type, you may have to have something like:

ToDays(Today() - ToDate([Date/Time Field]))

• #### 6.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 16:31
That worked! Thanks!

• #### 7.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 18:11
I have another issue, so I'm trying to calculate the difference between the assigned start date from todays date.  This is for the user to know how many days he has left to start the project, now I would like a value of NA to indicate the project has already started.  How do I go about that?

• #### 8.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 18:54
You could set up an "If" statement if you have a "Project Start Date" but I think the field would have to be a formula text field:

If(
not IsNull([Project Start Date]),"N/A",
ToText(ToDays(Today() - ToDate([Assigned Date]))
)
)

unfortunately with this is if you sort by this field, it will sort alphabetically and not numerically. For example, if you had the data: 1, 2, 3, 4, 12, 22, 42, N/A
it would sort to this:
1
12
2
22
3
4
42
N/A

• #### 9.  RE: How can you subtract a date field from the current day's date?

Posted 02-06-2019 20:16
^^^^ What he said.