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. date comparision in javascript with asp.net

date comparision in javascript with asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpjavascriptasp-nettutorial
7 Posts 4 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.
  • P Offline
    P Offline
    paya1pa
    wrote on last edited by
    #1

    hi expert, i want to campare two date in specific situation ex. todate and fromdate i enter the todate =02/10/2009 and from date is =03/10/2009 the above example show to you the from date is greater than todate if fromdate is not greater than todate i hope you understand my querry Please reply i wait.

    P M 2 Replies Last reply
    0
    • P paya1pa

      hi expert, i want to campare two date in specific situation ex. todate and fromdate i enter the todate =02/10/2009 and from date is =03/10/2009 the above example show to you the from date is greater than todate if fromdate is not greater than todate i hope you understand my querry Please reply i wait.

      P Offline
      P Offline
      Parwej Ahamad
      wrote on last edited by
      #2

      [Message Deleted]

      M 1 Reply Last reply
      0
      • P Parwej Ahamad

        [Message Deleted]

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        Parwej Ahamad wrote:

        Console.WriteLine

        Console.WriteLine in ASP.Net :omg:

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        P 1 Reply Last reply
        0
        • P paya1pa

          hi expert, i want to campare two date in specific situation ex. todate and fromdate i enter the todate =02/10/2009 and from date is =03/10/2009 the above example show to you the from date is greater than todate if fromdate is not greater than todate i hope you understand my querry Please reply i wait.

          M Offline
          M Offline
          Manas Bhardwaj
          wrote on last edited by
          #4

          paya1pa wrote:

          i hope you understand my querry

          Not exactly, but you may try somethig like this with the Date [^]object in javascript:

          var toDate = new Date('02/10/2009');
          var fromDate = new Date('03/10/2009');

          if(fromDate > toDate)
          alert('From date is greater...');

          Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

          A 1 Reply Last reply
          0
          • M Manas Bhardwaj

            paya1pa wrote:

            i hope you understand my querry

            Not exactly, but you may try somethig like this with the Date [^]object in javascript:

            var toDate = new Date('02/10/2009');
            var fromDate = new Date('03/10/2009');

            if(fromDate > toDate)
            alert('From date is greater...');

            Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

            A Offline
            A Offline
            Abhishek Sur
            wrote on last edited by
            #5

            Manas Bhardwaj wrote:

            var toDate = new Date('02/10/2009'); var fromDate = new Date('03/10/2009');

            But This means

            toDate = 10th Feb 2009
            fromDate = 10th March 2009

            So it is better to use setFullYear(year,month -1, day) like this:

            var toDate=new Date();
            toDate.setFullYear(2009,9,2); // Represents 2nd October 2009.

            :)

            Abhishek Sur


            My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB

            **Don't forget to click "Good Answer" if you like to.

            1 Reply Last reply
            0
            • M Manas Bhardwaj

              Parwej Ahamad wrote:

              Console.WriteLine

              Console.WriteLine in ASP.Net :omg:

              Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

              P Offline
              P Offline
              Parwej Ahamad
              wrote on last edited by
              #6

              It was my mistake. Thought he is asking in asp.net and did't read his subject.

              Parwej Ahamad ahamad.parwej@gmail.com

              M 1 Reply Last reply
              0
              • P Parwej Ahamad

                It was my mistake. Thought he is asking in asp.net and did't read his subject.

                Parwej Ahamad ahamad.parwej@gmail.com

                M Offline
                M Offline
                Manas Bhardwaj
                wrote on last edited by
                #7

                Parwej Ahamad wrote:

                It was my mistake

                Things happen ;)

                Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

                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