Quantcast
Viewing all articles
Browse latest Browse all 10045

DateDiff Help (Need time difference FROM Time 1 TO Time 2 - one direction)

I hope I am putting this in the right section. This is my first post. Thank you all ahead of time for your help.

I am new to both SQL and Report Builder so please bear with me and thank you ahead of time.

I need to find the time difference (in minutes) between Time 1 and Time 2. I've figured out the basics in how to do this but I need the logic to work in ONE DIRECTION. Meaning I need the statement to find the difference STARTING FROM TIME 1 and then ENDING WITH TIME 2. I need the statement to always assume that Time 1 is FIRST and that Time 2 is LAST.

Here's an example of my results now with a basic DateDiff statement.

Time 1 | Time 2 | Time Difference (in minutes)

11:30 | 1/15/2015 11:50:00 AM | 20

23:50 | 1/15/2015 12:00:00 AM | 1430

23:45 | 1/15/2014 2:05:00 AM | 1300

Please note that Time 1 does NOT have a date at all and came over from its table as a simple 4 digit string so I had to convert it to datetime format using a concatenate statement. If it DID have a date then this probably wouldn't be a problem.

Thoughts?

Thanks.




Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>