I am trying to calculate Today’s date from a date within excel formatted as DateTime (5/26/2018 10:22:47 AM) When I try to subtract them I get (226.13:37:13). How can I get the calculation to present just 226 without the time?
Hi @pparmly
well after the subtraction of two dates you will have a timeSpan,
to get only the first part of days you should use this to your substractedDate
YourSubstractedDate.Days().ToString()
Example
(Now.AddDays(2).AddHours(3) - Now).Days().tostring) ===> 2 instead of 2.03:00:00
Regards,
Reda
1 Like
Hello @Kamesh
you can achieve this using the expression
yourDate.ToString("yyyy-MM-dd HH:mm:ss.fff")
for example:

Cheers.
Reda
1 Like
VERY SIMPLE…
EG:-
- When you try to get the number of days from 1st Jan 2020 till today(10th Feb 2020), do the following:-
DateTime FromDate = 2019-01-01
(Today-FromDate).Days.
You will get the total number of days… ie: 40
