Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3622796
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:18:14+00:00 2026-05-18T23:18:14+00:00

I have written a function using javascript for validating a Date selected from a

  • 0

I have written a function using javascript for validating a Date selected from a calendar to a text box, with the current date. And I not getting a correct result. The date format displayed in text box is “01-Oct-2010”. And the function i had created is as follows :

function CheckDate() {
    var today = new Date();
    var startDate = document.getElementById("<%=txtStartDate.ClientID %>").value;
    var endDate = document.getElementById("<%=txtEndDate.ClientID %>").value;

    if (Date.parse(endDate) >= today) {
        alert("End Date should not be greater than Today");
    }

    return true;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:18:15+00:00Added an answer on May 18, 2026 at 11:18 pm
    var myDt=new Date(); 
    myDOB = document.getElementById('dateField').value.split('-');
    myDate = myDOB[0];
    myMonth= getMonthInDigit(myDOB[1]);
    myYear = myDOB[2];
    var now = new Date();
    myDt.setFullYear(myYear,myMonth,myDate); //here year, month, date value should be parsed from the value u get
    var diff = (now.getTime() - myDt.getTime()) 
    if(diff < 0){ 
      alert("End Date should not be greater than Today"); 
    }
    

    you can use the above javascript code.

    Note: Make getMonthInDigit function which return value in digit as required.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a function that gets a given number of random records from
i have written a snake program using javascript.. the problem is that the snake
I have written a form using the jQuery .post() function to post the data
I have written some code using jQuery to use Ajax to get data from
I have a simple function written in Oracle 9i (version 9.2.0.4.0) to simulate an
I have a function I've written that was initially supposed to take a string
I have written an AIR Application that downloads videos and documents from a server.
I have written a set of javascript functions that allow me to validate user
I'm learning javascript and jquery and have written a very basic script inside my
I have written a cascading drop down list using JQuery. The code that I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.