# Weekly Challenge

Solve the challenge, share your solution and summit the ranks of our Community!
###### IDEAS WANTED

We're actively looking for ideas on how to improve Weekly Challenges and would love to hear what you think!

Submit Feedback
We've recently made an accessibility improvement to the community and therefore posts without any content are no longer allowed. Please use the spoiler feature or add a short message in the message body in order to submit your weekly challenge.

## Challenge #68: Elapsed Classroom Times

Highlighted
8 - Asteroid

Thanks JoeM.

Highlighted
Alteryx Partner
Spoiler
I'm not such a fan of the huge expressions, so I choose for an approach with more tools, with a bit more cleaner operations in them.
Highlighted
8 - Asteroid

Highlighted
8 - Asteroid

Here you are.

Highlighted
8 - Asteroid

Here is my solution

Highlighted
7 - Meteor

Here is my solution!

Highlighted
8 - Asteroid

Probably not the most efficient, but I got the job done. I considered a few assumptions with 0 and negative values. Details in the spoiler.

Spoiler
The first time I ran through this, I converted military to standard first, then calculated minutes. However, this produced incorrect results. So I started over and did all the calculating off military first then converted to standard time while keeping the military calculation.

To start, I inserted a colon in the middle of the text string so I'd be able to convert to time using DateTime. I then used select to convert the original times into numerical values so I could convert them into standard time using numerical calculations, and converted the new times into strings so I'd be able to perform DateTimeDiff function to calculate elapsed time. Next I used select to convert original back to string and performed the insert colon formula a second time to capture the standard time in place of the military time.

At this point, I had to make a couple of assumptions. If Elapsed = 0 then I assumed it was a 24 hour (1440 minute) elapsed time. For example, if start time is 2:00 and end time is 2:00, then I assume it's 2:00 into the following day. I know it's not a 12 hour difference because I did the elapsed time based off of Military (this is why I had to start over from the first attempt). Thus, I converted all 0s into 1440. I also assumed negative values to flow into the following day as well, but less than 24 hours. You can't take a course in negative time. So if start was 11:00 and end was 10:50, then I assume it was 10 minutes shy of 24 hours. In this calculation I did 1440 + the negative value.

Highlighted
Alteryx Certified Partner

Highlighted
6 - Meteoroid

Feels like I've created a pretty complicated process here, but it is effective.

Spoiler

Highlighted
8 - Asteroid