Results 1 to 3 of 3

Thread: [RESOLVED] substracting datetime var to integer

  1. #1

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Resolved [RESOLVED] substracting datetime var to integer

    hi,
    In how to code this one in C# ? I would like to subtract datetime variable in order to get day. sample below.
    10/10/05 - 10/06/05 =4
    10/10/05 - 10/10/05 = 0


    thanks,
    popskie

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: substracting datetime var to integer

    Example :

    Code:
    DateTime t1=new DateTime(2005,10,20);
    			DateTime t2=new DateTime(2005,10,25);
    
    			TimeSpan newdate=t2.Subtract(t1);
    			msg.Show(newdate.TotalDays.ToString());

  3. #3

    Thread Starter
    Fanatic Member popskie's Avatar
    Join Date
    Jul 2005
    Location
    In my chair
    Posts
    666

    Re: substracting datetime var to integer

    thanks for the quick reponse it need very hury.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width