Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • 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.

Students Click Here

calculate days between different da

calculate days between different da

calculate days between different da

calculate days between different date and time:

Please help me if anything wrong here:

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))

Appreciate your help!!

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.


"Nature forges everything on the anvil of time"

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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

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:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close