Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Find date diiference

Find date diiference

Scheduled Pinned Locked Moved ASP.NET
csharphelptutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BINOVAR
    wrote on last edited by
    #1

    Hi all, can any please tell me how to find difference between two dates in a web application using Vb.net. I used diff1 = (CDate(day2).Subtract(CDate(day1)).TotalHours) Label11.Text = diff2 & "hrs" diff3 = (CDate(day3).Subtract(CDate(day2)).TotalHours) Label12.Text = diff3 & "hrs" Its working fine in the Local system without any conversion problems,but in a intranet its showing error Conversion from string "13/04/2006 4:11:50 PM" to type 'Date' is not valid. please give me suggestions Thanks in Advance Bino Varghese

    S 1 Reply Last reply
    0
    • B BINOVAR

      Hi all, can any please tell me how to find difference between two dates in a web application using Vb.net. I used diff1 = (CDate(day2).Subtract(CDate(day1)).TotalHours) Label11.Text = diff2 & "hrs" diff3 = (CDate(day3).Subtract(CDate(day2)).TotalHours) Label12.Text = diff3 & "hrs" Its working fine in the Local system without any conversion problems,but in a intranet its showing error Conversion from string "13/04/2006 4:11:50 PM" to type 'Date' is not valid. please give me suggestions Thanks in Advance Bino Varghese

      S Offline
      S Offline
      SHatchard
      wrote on last edited by
      #2

      Hi I would suggest looking at the date settings on the server, make sure that its set to the same date format as you are wanting to use. As an aside take a look at the DateDiff function http://msdn2.microsoft.com/en-us/library/b5xbyt6f(VS.80).aspx[^] Which will provide a much simpler implementation of your code.

      B 1 Reply Last reply
      0
      • S SHatchard

        Hi I would suggest looking at the date settings on the server, make sure that its set to the same date format as you are wanting to use. As an aside take a look at the DateDiff function http://msdn2.microsoft.com/en-us/library/b5xbyt6f(VS.80).aspx[^] Which will provide a much simpler implementation of your code.

        B Offline
        B Offline
        BINOVAR
        wrote on last edited by
        #3

        Thank you ..will check your reference site..

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups