date time diff - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

date time diff

mehrdadabdimehrdadabdi Posts: 1Member
Good day,
I am writting a small program for a company,
I need a a function to clalculate the date time different. like DateTimeDiff(startdate, enddate) so I can calculate the employee worked time and salary. I am using c# and I am searching for 2 days now for this function. I found some classes in VB ans javascript but nothing in C#.

please help me.
Regards,
Mehrdad

Comments

  • pingpongpingpong Posts: 937Member
    Use the TimeSpan structure, something lile:
    [code]
    DateTime start = DateTime.Now;
    // do some work
    DateTime end = DateTime.Now;
    TimeSpan span = end - start;
    Console.WriteLine("Time: {0}", span);
    [/code]

    : Good day,
    : I am writting a small program for a company,
    : I need a a function to clalculate the date time different. like DateTimeDiff(startdate, enddate) so I can calculate the employee worked time and salary. I am using c# and I am searching for 2 days now for this function. I found some classes in VB ans javascript but nothing in C#.
    :
    : please help me.
    : Regards,
    : Mehrdad
    :
Sign In or Register to comment.