Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Any C#fags around here?

Name: Anonymous 2010-02-01 17:40

I just have a quick question about calculating a timespan of sorts.

Basically I have two variables:

int depart = 0930;
int arrive = 1545;

where both are integers representing military time.

Is there a simple way to get a return value based on those integers which gives me a timespan in minutes? In the end, I need to get two separate values for hours and minutes, but I can just divide and mod the total minutes by 60 for those values.

I'm pretty new to C# and I know it has DateTime and TimeSpan stuff predefined and I'm hoping that there's a simple way to use one of those for what I need as opposed to writing an entire method from scratch

Name: Anonymous 2010-02-01 20:54

writing an entire method from scratch


int mil2min(int mil) {
  int min = mil % 100;
  int hour = mil / 100;
  min += mil * 60;
  return min
}

WAS THAT SO HARD?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List