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

  • Home
  • SEARCH
  • 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 9138211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:13:37+00:00 2026-06-17T09:13:37+00:00

Here the code $(document).ready(function() { $(‘#st’).change(function(){ var st = $(‘#st’).val(); // start time Format:

  • 0

Here the code

$(document).ready(function() {
    $('#st').change(function(){
        var st = $('#st').val(); // start time Format: '9:00 PM'
        var et = $('#et').val(); // end time   Format: '11:00 AM' 

        //how do i compare time
            if(st > et)
            {
               alert('end time always greater then start time');
            }
    });
});

if i have time range as follows

Start Time Range (listbox) =   12:00 AM To 11:59PM

End Time Range  (listbox)  =   12:00 AM To 11:59PM

then how to validate start-time less then end-time OR end-time greater then start-time

Start-time < End-time  OR  End-time > St-time

consider time format in js-code, due to time-format am unable to implement difference logic

Format: '9:00 AM'
Format: '5:00 PM'
  • 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-06-17T09:13:38+00:00Added an answer on June 17, 2026 at 9:13 am

    Here i got after investigate this.
    The best practice if Time Format in 12 Hour-Time Or 24 Hour-Time.

    //start time
    var start_time = $("#start_time").val();
    
    //end time
    var end_time = $("#end_time").val();
    
    //convert both time into timestamp
    var stt = new Date("November 13, 2013 " + start_time);
    stt = stt.getTime();
    
    var endt = new Date("November 13, 2013 " + end_time);
    endt = endt.getTime();
    
    //by this you can see time stamp value in console via firebug
    console.log("Time1: "+ stt + " Time2: " + endt);
    
    if(stt > endt) {
        $("#start_time").after('<span class="error"><br>Start-time must be smaller then End-time.</span>');
        $("#end_time").after('<span class="error"><br>End-time must be bigger then Start-time.</span>');
            return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my code: $(document).ready(function() { $('#add_btn').click(function() { var src$ = $('#img_loc').val(); $('<img>').attr({ src:
Here is my code: $(document).ready(function() { $('#add_btn').click(function() { var src$ = $('#img_loc').val(); $('<img>').attr({ src:
Here is my code: $(document).ready(function(){ //These variables are for loading more posts var create_ptr
Here's my code: $(document).ready(function(){ var Bold=Yes! There is bold in the text above!!; var
Here's my code: $(document).ready(function () { var default_var = 2; var show_var = default_var;
I have a webservice returning jsonp format. here's the code: $(document).ready(function(){ $.getJSON(http://api.tubeupdates.com/?method=get.status&lines=central,victoria&return=name&jsonp=?, function (result){
Here is my code: $(document).ready(function() { img$ = ''; var img$ = img$ +
So here is my code: $(document).ready( function() { $('#form').bind('change', function(){ $.ajax({ type: 'get', url:
I have some code here: $(document).ready(function() { $(#querybox).live(keyup, function(e) { var code = (e.keyCode
I have been using this code here: $(document).ready(function(){ $('a[href*=#]').bind('click', function(){ var $href = $(this).attr('href')

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.