×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# calculate days between different da

## calculate days between different da

(OP)
calculate days between different date and time:

Problem is here: e.g, test_dt=3/22/2017, test_tm=10:50:00; dx_dt=3/24/2017, dx_tm=9:45:00 but the result is 3.00 (days) not 2.96(days)

if( dx_tm>=test_tm, (daysafter( test_dt, dx_dt )) + ((secondsafter(test_tm, dx_tm)/3600))/24, ((daysafter( test_dt, dx_dt )) + (1-abs(secondsafter(test_tm, dx_tm)/3600))/24))

### RE: calculate days between different da

I suggest you test your expression by adding some temp columns to separate the time and day components to make sure the pieces are being evaluated properly.

Matt

"Nature forges everything on the anvil of time"
www.anvil-of-time.com

### RE: calculate days between different da

Try converting the DaysAfter between the dates to seconds by multiplying it by 86400, then add the
SecondsAfter between the time, then convert the result back to days by dividing it by 86400. For example:

ldec_days = ((DaysAfter(test_dt, dx_dt) * 86400) + SecondsAfter(test_tm, dx_tm)) / 86400

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Close Box

# Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!