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. compare Duration using asp.net vb

compare Duration using asp.net vb

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsaleshelptutorial
8 Posts 3 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.
  • S Offline
    S Offline
    Sarfaraj Ahmed
    wrote on last edited by
    #1

    Hello Everybody I have already posted a similar topic but that one was bit confusing. This is why I am writting again. 1. Customer can choose date and time from textbox or dropdown. When customer click submit button then I want to check whether their selected date and time 8 hours more than system date and time or not. For Example: System.Today.DateTime = 10/02/09 05:06:50 , I want to compare System.Today.DateTime with customer selected data and time. Please help me Thanks in Advance Sarfaraj

    Sarfarj Ahmed

    A A 2 Replies Last reply
    0
    • S Sarfaraj Ahmed

      Hello Everybody I have already posted a similar topic but that one was bit confusing. This is why I am writting again. 1. Customer can choose date and time from textbox or dropdown. When customer click submit button then I want to check whether their selected date and time 8 hours more than system date and time or not. For Example: System.Today.DateTime = 10/02/09 05:06:50 , I want to compare System.Today.DateTime with customer selected data and time. Please help me Thanks in Advance Sarfaraj

      Sarfarj Ahmed

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Sarfaraj Ahmed wrote:

      I have already posted a similar topic but that one was bit confusing. This is why I am writting again.

      There is no need of repost. If that was not clear, please modify that one rather than Cross Post.

      cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

      S 1 Reply Last reply
      0
      • A Abhijit Jana

        Sarfaraj Ahmed wrote:

        I have already posted a similar topic but that one was bit confusing. This is why I am writting again.

        There is no need of repost. If that was not clear, please modify that one rather than Cross Post.

        cheers, Abhijit CodeProject MVP My Recent Article : Exploring Session in ASP.Net

        S Offline
        S Offline
        Sarfaraj Ahmed
        wrote on last edited by
        #3

        thank you very much

        Sarfarj Ahmed

        1 Reply Last reply
        0
        • S Sarfaraj Ahmed

          Hello Everybody I have already posted a similar topic but that one was bit confusing. This is why I am writting again. 1. Customer can choose date and time from textbox or dropdown. When customer click submit button then I want to check whether their selected date and time 8 hours more than system date and time or not. For Example: System.Today.DateTime = 10/02/09 05:06:50 , I want to compare System.Today.DateTime with customer selected data and time. Please help me Thanks in Advance Sarfaraj

          Sarfarj Ahmed

          A Offline
          A Offline
          ABitSmart
          wrote on last edited by
          #4

          i have not read you last post. from this one if I understood you correct,

          DateTime current = DateTime.Now;
          //inputDate is the date specified by customer

          Timespan t = current.Subtract(inputDate );

          The timespan object will have the difference. i.e. re.TotalHours will have the hour difference.

          S 2 Replies Last reply
          0
          • A ABitSmart

            i have not read you last post. from this one if I understood you correct,

            DateTime current = DateTime.Now;
            //inputDate is the date specified by customer

            Timespan t = current.Subtract(inputDate );

            The timespan object will have the difference. i.e. re.TotalHours will have the hour difference.

            S Offline
            S Offline
            Sarfaraj Ahmed
            wrote on last edited by
            #5

            Thank You very much your code does make sense. Could you please tell me a bit detail 1. You are right, input is coming from customer 2. If I substract the input then do I need to specifie any format ex. 10/02/09 5:47

            Sarfarj Ahmed

            A 1 Reply Last reply
            0
            • A ABitSmart

              i have not read you last post. from this one if I understood you correct,

              DateTime current = DateTime.Now;
              //inputDate is the date specified by customer

              Timespan t = current.Subtract(inputDate );

              The timespan object will have the difference. i.e. re.TotalHours will have the hour difference.

              S Offline
              S Offline
              Sarfaraj Ahmed
              wrote on last edited by
              #6

              is their anything i can to calculate difrence only hour, eg: 1. 60 hours 2. Not 2 Days and 12 hours

              Sarfarj Ahmed

              A 1 Reply Last reply
              0
              • S Sarfaraj Ahmed

                Thank You very much your code does make sense. Could you please tell me a bit detail 1. You are right, input is coming from customer 2. If I substract the input then do I need to specifie any format ex. 10/02/09 5:47

                Sarfarj Ahmed

                A Offline
                A Offline
                ABitSmart
                wrote on last edited by
                #7

                Convert.ToDateTime uses the current culture. If you want to do culture specific stuff then u wud have to use DateTime.Parse passing it the culture.

                1 Reply Last reply
                0
                • S Sarfaraj Ahmed

                  is their anything i can to calculate difrence only hour, eg: 1. 60 hours 2. Not 2 Days and 12 hours

                  Sarfarj Ahmed

                  A Offline
                  A Offline
                  ABitSmart
                  wrote on last edited by
                  #8

                  Timespan's TotalHours property does give you the total difference of hours ?

                  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