You must Sign In to post a response.
  • Category: ASP.NET

    date difference using asp.net

    i have 2 values in 2 textbox, so i want to find the difference days b/w this

    pls hepl me
  • #278986
    You can use datetime object of asp.net datetime class.which will allow you to do it.
    also you can do it through date object of javascript.
    I do not have snippet but I prefer you to create ur own logic using this guidance. :)

    Ketan raval
    Software developer
    http://www.letsnurture.co.cc/

  • #278995
    Dim dt As DateTime = Convert.ToDateTime(TextBox1.Text)
    Dim dt1 As DateTime = Convert.ToDateTime(TextBox2.Text)
    Dim ts As TimeSpan = dt1.Subtract(dt)

    Response.Write(ts.Days)

  • #278996
    Hi,


    In asp.net with Vb as code behind we can use with DateDiff() function. below is the sample for doing it.

    Dim lngdiff As Long = DateDiff(DateInterval.Hour, CDate(TextBox2.Text), CDate(TextBox3.Text))

    Regards
    JK

    Thanks & Regards
    D.Jeya Kumar(JK)

  • #279020
    Hi,

    You can use timespan

    thanks and regards,
    Kumar


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.