JavaScript - Please Help Me With Date Code To Show Up Pm When (h>11) And Am When(h<11).
Hi,
Please i have this code here which is not working to my expectation.Even though the code shows up the date alright but i want to add when it is morning should be AM whiles in evening PM. I have tried several ways to get it but i'm not.please help me to add a code to show PM when the time is (h>11) and AM when (h<11) .Here is what i did Code: <script type="text/javascript"> function runTime(){ var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); if(m<10){ m="0"+m; } document.getElementById("text").innerHTML=h+":"+m+":"+s; t=setTimeout('runTime()',500); } if(h>11) { document.write("PM"); } else{ document.write("AM"); } </script> <body onload="runTime()"> <div id="text"></div> </body> Thank you. Clement Osei. Similar TutorialsI have this script that I got from some site. When you click on a link tied to a div it hides all other divs and displays just that one. Well, that works, but I want it to display one of the divs on page load based on today's date. For example, it will display the "summer" div if today's date is anywhere between June 1 and August 31. When links to other divs are clicked that div will disappear and other ones will appear in its place. Anyway, here's the code, and I don't know anything about javascript so I have no idea where to even start editing it. Please help Code: <script type="text/javascript"> <!-- Layer Show/Hide Script last="" function changeDiv(the_div,the_change) { var the_style = getStyleObject(the_div); if (the_style != false) { the_style.display = "block" if(last!="") { last.display = "none" } } last=the_style } function getStyleObject(objectId) { if (document.getElementById && document.getElementById(objectId)) { return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { return document.all(objectId).style; } else { return false; } } //--> </script> Does anyone know of a javascript code that will always show the date of next tuesday? We have a reoccurring event every tuesday, so as soon as wednesday hits, we need the date to change to the following tuesday. Any help or point in the right direction is appreciated. Thanks! I have been using the following script for some time and it has only just been made known to me that it fails on todays date ! not sure if this is the case for other days but the days of the week are all messed up and do not show correctly for a date in June 2011. Code: var ds_i_date = new Date(); ds_c_month = ds_i_date.getMonth() + 1; ds_c_year = ds_i_date.getFullYear(); // Get Element By Id function ds_getel(id) { return document.getElementById(id); } // Get the left and the top of the element. function ds_getleft(el) { var tmp = el.offsetLeft; el = el.offsetParent while(el) { tmp += el.offsetLeft; el = el.offsetParent; } return tmp; } function ds_gettop(el) { var tmp = el.offsetTop; el = el.offsetParent while(el) { tmp += el.offsetTop; el = el.offsetParent; } return tmp; } // Output Element var ds_oe = ds_getel('ds_calclass'); // Container var ds_ce = ds_getel('ds_conclass'); // Output Buffering var ds_ob = ''; function ds_ob_clean() { ds_ob = ''; } function ds_ob_flush() { ds_oe.innerHTML = ds_ob; ds_ob_clean(); } function ds_echo(t) { ds_ob += t; } var ds_element; // Text Element... var ds_monthnames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ]; // You can translate it for your language. var ds_daynames = [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ]; // You can translate it for your language. // Calendar template function ds_template_main_above(t) { return '<table cellpadding="3" cellspacing="1" class="ds_tbl">' + '<tr>' + '<td class="ds_head" style="cursor: pointer" onclick="ds_py();"><<</td>' + '<td class="ds_head" style="cursor: pointer" onclick="ds_pm();"><</td>' + '<td class="ds_head" style="cursor: pointer" onclick="ds_hi();" colspan="3">[Close]</td>' + '<td class="ds_head" style="cursor: pointer" onclick="ds_nm();">></td>' + '<td class="ds_head" style="cursor: pointer" onclick="ds_ny();">>></td>' + '</tr>' + '<tr>' + '<td colspan="7" class="ds_head">' + t + '</td>' + '</tr>' + '<tr>'; } function ds_template_day_row(t) { return '<td class="ds_subhead">' + t + '</td>'; // Define width in CSS, XHTML 1.0 Strict doesn't have width property for it. } function ds_template_new_week() { return '</tr><tr>'; } function ds_template_blank_cell(colspan) { return '<td colspan="' + colspan + '"></td>' } function ds_template_day(d, m, y) { return '<td class="ds_cell" onMouseout="this.style.background=\'#EEE\';" onMouseover="this.style.background=\'#999\';" onclick="ds_onclick(' + d + ',' + m + ',' + y + ')">' + d + '</td>'; // Define width the day row. } function ds_template_main_below() { return '</tr>' + '</table>'; } // This one draws calendar... function ds_draw_calendar(m, y) { // First clean the output buffer. ds_ob_clean(); // Here we go, do the header ds_echo (ds_template_main_above(ds_monthnames[m - 1] + ' ' + y)); for (i = 0; i < 7; i ++) { ds_echo (ds_template_day_row(ds_daynames[i])); } // Make a date object. var ds_dc_date = new Date(); ds_dc_date.setMonth(m - 1); ds_dc_date.setFullYear(y); ds_dc_date.setDate(1); if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12) { days = 31; } else if (m == 4 || m == 6 || m == 9 || m == 11) { days = 30; } else { days = (y % 4 == 0) ? 29 : 28; } var first_day = ds_dc_date.getDay(); var first_loop = 1; // Start the first week ds_echo (ds_template_new_week()); // If sunday is not the first day of the month, make a blank cell... if (first_day != 0) { ds_echo (ds_template_blank_cell(first_day)); } var j = first_day; for (i = 0; i < days; i ++) { // Today is sunday, make a new week. // If this sunday is the first day of the month, // we've made a new row for you already. if (j == 0 && !first_loop) { // New week!! ds_echo (ds_template_new_week()); } // Make a row of that day! ds_echo (ds_template_day(i + 1, m, y)); // This is not first loop anymore... first_loop = 0; // What is the next day? j ++; j %= 7; } // Do the footer ds_echo (ds_template_main_below()); // And let's display.. ds_ob_flush(); // Scroll it into view. //ds_ce.scrollIntoView(); } // A function to show the calendar. // When user click on the date, it will set the content of t. function ds_sh(t) { // Set the element to set... ds_element = t; // Make a new date, and set the current month and year. var ds_sh_date = new Date(); ds_c_month = ds_sh_date.getMonth() + 1; ds_c_year = ds_sh_date.getFullYear(); // Draw the calendar ds_draw_calendar(ds_c_month, ds_c_year); // To change the position properly, we must show it first. ds_ce.style.display = ''; // Move the calendar container! the_left = ds_getleft(t); the_top = ds_gettop(t) + t.offsetHeight; ds_ce.style.left = the_left + 'px'; ds_ce.style.top = the_top + 'px'; // Scroll it into view. //ds_ce.scrollIntoView(); } // Hide the calendar. function ds_hi() { ds_ce.style.display = 'none'; } // Moves to the next month... function ds_nm() { // Increase the current month. ds_c_month ++; // We have passed December, let's go to the next year. // Increase the current year, and set the current month to January. if (ds_c_month > 12) { ds_c_month = 1; ds_c_year++; } // Redraw the calendar. ds_draw_calendar(ds_c_month, ds_c_year); } // Moves to the previous month... function ds_pm() { ds_c_month = ds_c_month - 1; // Can't use dash-dash here, it will make the page invalid. // We have passed January, let's go back to the previous year. // Decrease the current year, and set the current month to December. if (ds_c_month < 1) { ds_c_month = 12; ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid. } // Redraw the calendar. ds_draw_calendar(ds_c_month, ds_c_year); } // Moves to the next year... function ds_ny() { // Increase the current year. ds_c_year++; // Redraw the calendar. ds_draw_calendar(ds_c_month, ds_c_year); } // Moves to the previous year... function ds_py() { // Decrease the current year. ds_c_year = ds_c_year - 1; // Can't use dash-dash here, it will make the page invalid. // Redraw the calendar. ds_draw_calendar(ds_c_month, ds_c_year); } // Format the date to output. function ds_format_date(d, m, y) { // 2 digits month. m2 = '00' + m; m2 = m2.substr(m2.length - 2); // 2 digits day. d2 = '00' + d; d2 = d2.substr(d2.length - 2); // YYYY-MM-DD return d2 + '-' + m2 + '-' + y; } // When the user clicks the day. function ds_onclick(d, m, y) { // Hide the calendar. ds_hi(); // Set the value of it, if we can. if (typeof(ds_element.value) != 'undefined') { ds_element.value = ds_format_date(d, m, y); // this part is a personal bit of code to allow my page to update correctly and in time. if("fireEvent" in ds_element) ds_element.fireEvent("onChange"); else { var evt = document.createEvent("HTMLEvents"); evt.initEvent("change", false, true); ds_element.dispatchEvent(evt); } // // Maybe we want to set the HTML in it. } else if (typeof(ds_element.innerHTML) != 'undefined') { ds_element.innerHTML = ds_format_date(d, m, y); // I don't know how should we display it, just alert it to user. } else { alert (ds_format_date(d, m, y)); } } what can be the reasons for the same code which works perfectly in notepad to not show its result in a jsp application done using eclipse??anything to do with settings? I am not able to display the current date as default in dd/mm/yyyy format in drop down boxes..only dd and yyyy apears but month isnt apearing as default.. can u suggest alternative logic and its code to implement the same?? So i have this code and i know its a lot but my question is when you create a mine or a sawmill it does not add to the number of them it only work with farms. But when you create any of them it still works it just does not show how many you have. HTML Code: <body onload="sstart(); clock(); "> Time:<input type="text" id="timeee" value="15" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Rounds:<input type="text" id="rounds" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Popularity:<input type="text" id="popularity" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Population: <input type="text" id="pop" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY />/ <input type="text" id="pop2" value="0" size="1"style="background-color:transparent;border:0px solid white;" READONLY /> Coin:<input type="text" id="coin" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Lumber:<input type="text" id="lumber" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Iron:<input type="text" id="iron" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Food:<input type="text" id="food" value="0" size="1" style="background-color:transparent;border:0px solid white;" READONLY /> <br/> <hr/> <br/> <input type="button" onclick="showfood()" id="food" value=" Food " /> <input type="button" onclick="showsw()" id="SM" value=" Saw Mill " /> <input type="button" onclick="showmine()" id="SM" value=" Mines " /> <input type="button" onclick="showtax()" id="tax" value=" Tax " /> <input type="button" onclick="" id="housing" value=" People " /> <input type="button" onclick="" id="army" value=" Army " /> <input type="button" onclick="" id="trade" value=" World " /> <br/> <Br/> <span id="main"></span> Script Code: //////////time time function time(){ res [3] [1] += res [7] [1]; res [2] [1] += res [9] [1]; res [1] [1] += res [11] [1]; res [3] [1] -= res [5] [2] ; //res [3] [1] -= res [5] [1] ; } function sstart(){ var b=setTimeout("start();",1); var b=setTimeout("clocka();",15000); var b=setTimeout("time();",15000); var b=setTimeout("sstart();",15000); } function clock(){ document.getElementById("timeee").value --; var b=setTimeout("clock();",1000); } function clocka(){ document.getElementById("timeee").value = 15; document.getElementById("rounds").value ++; } ///////////////////////time var res = new Array res [0] = ["Coin: ",50,0]; res [1] = ["Lumber: ",100,0]; res [2] = ["Iron: ",25,0]; res [3] = ["Food: ",100,0]; res [4] = ["Popularity: ",0,0]; res [5] = ["POP: ",0,10]; res [6] = ["farms: ",0,0]; res [7] = ["CIfarms: ",0,0]; res [8] = ["mine: ",0,0]; res [9] = ["CImine: ",0,0]; res [10] = ["SW: ",0,0]; res [11] = ["CISW: ",0,0]; res [12] = ["FoodI: ",10,0]; res [13] = ["IronI: ",3,0]; res [14] = ["LumberI: ",10,0]; res [15] = ["TAX: ",0,0]; res [16] = ["CItax: ",0,0]; function start(){ document.getElementById("coin").value = res [0] [1]; document.getElementById("lumber").value = res [1] [1]; document.getElementById("iron").value = res [2] [1]; document.getElementById("food").value = res [3] [1]; document.getElementById("popularity").value = res [4] [1]; document.getElementById("pop").value = res [5] [1]; document.getElementById("pop2").value = res [5] [2]; document.getElementById("farms").innerHTML = res [6] [1]; document.getElementById("CIfarms").innerHTML = res [7] [1]; document.getElementById("mine").innerHTML = res [8] [1]; document.getElementById("CImine").innerHTML = res [9] [1]; document.getElementById("saw mills").innerHTML = res [10] [1]; document.getElementById("CISW").innerHTML = res [11] [1]; document.getElementById("tpp").innerHTML = res [15] [1]; } //FARMS FARMS FARMS FARMS FARMS FARMS var showfood = function() { var T1 = document.getElementById('main'); var T2 = '<input type="button" value="Build Farm" onclick="buildfarm()" /><br/> Farms:<span id="farms"></span><br/>Current Food Income:<span id="CIfarms"></span> '; T1.innerHTML = T2; start(); } function buildfarm(){ res [6] [1] +=1; res [1] [1] -=20; res [5] [1] +=10; res [0] [1] -=25; res [7] [1] += res [12] [1]; res [2] [1] -=3; start(); } </script> <script> /////////////////////////////mine var showmine = function() { var T3 = document.getElementById('main'); var T4 = '<input type="button" value="Find Mine" onclick="buildmine()" /><br/> Mines:<span id="mine"></span><br/>Current Iron Income:<span id="CImine"></span> '; T3.innerHTML = T4; start(); } function buildmine(){ res [8] [1] +=1; res [5] [1] +=15; res [0] [1] -=50; res [9] [1] += res [13] [1]; res [2] [1] -=7; res [1] [1] -=15; start(); } </script> <script> ///////////////////////////////SAWMILL var showsw = function() { var T5 = document.getElementById('main'); var T6 = '<input type="button" value="Build Saw Mill" onclick="buildsw()" /><br/> Saw Mills:<span id="saw mills"></span><br/>Current lumber Income:<span id="CISW"></span> '; T5.innerHTML = T6; start(); } function buildsw(){ res [2] [1] -=5; res [1] [1] -=20; res [5] [1] +=5; res [0] [1] -=25; res [10] [1] +=1; res [11] [1] += res [14] [1]; start(); } </script> <script> function taxplus(){ res [15] [1] +=1; } var showtax = function() { var T7 = document.getElementById('main'); var T8 = '<input type="button" value="Increase Tax Per Person" onclick="taxplus()" /> Tax Per Person:<span id="tpp"></span>'; T7.innerHTML = T8; start(); } Hi sir, I want to try use a javascript to display a code in this format....say May,wednesday 4, 2011 I have this code but it does not give me what i like Code: Code: <script type="text/javascript"> var currentTime=new Date() var day=currentTime.getDate() var month=currentTime.getMonth()+1 var year=currentTime.getFullYear() document.write("It is now "+day+"/"+month+"/"+year) </script> Please help me on a code like May,wednesday 4, 2011 Any help will be highly appreciated. Thanks Clement. Im trying to make a code to work out how i am using the new Date commands Code: var Year = prompt('Enter the year you were born','19XX'); var Month = prompt('Enter the month you were born','January'); var Day = prompt('Enter the day you were born','1'); var birthDay = new Date(' ' +Month+ +Day+', '+Year); // birthDay var currentTime = new Date(); currentYear = (currentTime.getFullYear()); currentYear = (currentYear - Year); alert(currentYear); This is as far as i can get i want to get in to an excate age but i dont know where to start can someone give me a hand is there a way to compare the two dates birthDay and currentTime? Thanks Hello all.. I am new to the programming world and I need some help please. Working on a website for work and needing some Java assistance. I am working on this website. (Very simple) http://opc.deq.state.ms.us/aqi/aqi-msgulfcoastozone.htm and I am trying to set up coding to where the dates are updated daily. The only problem is, that I do not want the dates to update at Midnight Central time. Instead... I want the dates to update at 4pm Central Time (Since that is when I update my forecast) I am the states meteorologist... My 1st inclination is to manipulate the code to where the date would change 4pm Central time which would be midnight (+8 hours) Europe/Helsinki time. I am just unsure on how to manipulate the code to do so.. my current coding is. script type="text/javascript"> <!-- var currentTime = new Date() var month = currentTime.getMonth() + 1 var day = currentTime.getDate() + 1 var year = currentTime.getFullYear() currentTime.setDate(currentTime.getDate()+0); document.write(month + "/" + day + "/" + year) //--> </script> Any assistance would be greatly appreciated.. I wish I was more familiar w/ coding ... Wish I would have taken coding classes in college. Again much appreciated for reading/taking time to help me out. Hello. I just want to check whether it is possible (and if so whether there is one available) to have a script that displays MY current time and date to visitors to my website. My time is Western European Time or Greenwich Mean Time. I would like visitors from eg Japan to see my local time and not their own. I think some date scripts I have seen use the user's local PC clock, but I am not sure? Thanks for any feedback and help! Hello all, I am creating a blog and I thought it would be cool to have the Konami code in it. Basically, I would like is to either show or hide a div when the code is entered. So lets say the Div is hidden, they would enter the code and it would then show. If it was entered while the div was shown, it would then hide. Is there any way to do this? I think there would be, but I don't know how to accomplish it. Here's a link to the Konami code I'm using: Code: if ( window.addEventListener ) { var state = 0, konami = [38,38,40,40,37,39,37,39,66,65]; window.addEventListener("keydown", function(e) { if ( e.keyCode == konami[state] ) state++; else state = 0; if ( state == 10 ) window.location = "http://example.com"; }, true); } Thank you! Could anyone tell me what I've doing wrong, on first click it detects that the div is hidden and makes it visible, button on second click it does nothing: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <link href="basic.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> function hideshow(id) { if (document.getElementById(id).style.visibility = "hidden") { document.getElementById(id).style.visibility = "visible"; } else { document.getElementById(id).style.visibility = "hidden"; } } </script> </head> <body> <div id="test" onclick="hideshow('test2')"> </div> <div id="test2" style="visibility:hidden"> </div> </body> </html> Hi, the source code on the website below i want to know what do i need to change to get the date to show as dd/mm/yyyy instead of mm/dd/yyyy? http://www.nsftools.com/tips/DatePickerTest.htm thanks for your help Problem with the Date when one date variable rolls back to a previous month. Everything is explained he http://kcmaindomain.com/fix-js.html View Page Source of that page to see the java script code. I would greatly appreciate the help as I am fairly amateur coder and I have no idea how to correct this myself. Not sure if this is possible in javascript: I'm looking for two different dates (bill date and due date) on an invoice that are captured by OCR. If one of them exists, but the other does not, I want the empty field to be 14 days before (or after) the other. For example: if the bill date is 7/27/2010 and the due date was not captured, I want to set the due date as 8/10/2010 (14 days after the bill date). If the due date was captured as 8/10/2010, but the due date is blank, I want to assign the bill date as 7/27/2010 (14 days before the due date). if both dates have values, do nothing. Thanks. Hello, I really need your help with one. How can I use the following code below to save the date from my popup window datepicker back into a var and relay it back onto its parent page? I can't seem to figure this out: Code: <html> <head> <script> function open_cal() { var str_html = "" + "<!DOCTYPE html>\n" + "<html lang=\"en\">\n" + "<head>\n" + "<meta charset=\"utf-8\">\n" + "<title>CALENDAR</title>\n" + "<link href=\"jq/jquery-ui.css\" rel=\"stylesheet\" type=\"text/css\">\n" + "<script src=\"jq/jquery.min.js\" type=\"text/javascript\"></" + "script>\n" + "<script src=\"jq/jquery-ui.min.js\" type=\"text/javascript\"></" + "script>\n" + "<script src=\"jq/datepicker.js\" type=\"text/javascript\"></" + "script>\n" + "</head>\n" + "<body>\n" + "<div id=\"text\" style=\"font: bold 10pt Tahoma\">Enter Approval Date:</div>\n" + "<div id=\"datepicker\"></div>\n" + "</body>\n" + "</html>" var j = window.open("","CALENDAR","width=200,height=250,status=no,resizable=yes,top=200,left=200") j.opener = self; j.document.write(str_html); } </script> </head> <body> <input onclick="open_cal()" type="button" value="Open" name="B1"> </body> </html> Datepicker.js: Code: $(function() { $( "#datepicker" ).datepicker({ dateFormat: 'dd/mm/yy', onSelect: function(dateText, inst) { alert(dateText) window.close() } }) }); Any help with this is greatly and mostly appreciated. Thanks in advance, Cheers, J Hi, I've inherited a Form which calculates a future date based on a calculation and then inserts today's date and the future date into a database. The day part of the date is formatted as a number. This is fine, but up to 9 the numbers display in single figures with no leading zeros. I want them to display leading zeros (e.g. 01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11... 30, 31) So; 1/12/2010 is NOT wanted 01/12/2010 IS wanted The inherited code originally set the Month names as "Jan", "Feb" etc, and it was easy to kludge these to 01, 02... 12, but I suspect there's a more elgant solution to this as well, this bit of the code works so it's not as vital to neaten this but my database needs dd/mm/yyyy format (it's a third party email program). Code: </script> <script type="text/javascript"> var todaysDate = new Date(); function updateExpiryDate(){ var weeklyMileage = document.getElementById('AvWeeklyMileage').value; var expiryDate; var weeks = 0; var expiryDateString = ''; if (!isNaN(parseInt(weeklyMileage))){ weeks = 700/weeklyMileage; expiryDate = new Date(todaysDate.getTime() + (1000 * 3600 * 24 * 7 * weeks)); var expiryDateString = expiryDate.getDate() + '/' + getMonthString(expiryDate.getMonth()+1) + '/' + expiryDate.getFullYear(); document.getElementById('expiryDate').innerHTML = expiryDateString; document.getElementById('ShoeExpiryDate').value = expiryDateString; } else { document.getElementById('ShoeExpiryDate').value = ''; document.getElementById('expiryDate').innerHTML = 'Please enter a valid weekly average mileage' } } function getMonthString(monthNumber){ var monthString = ""; switch(monthNumber){ case 1: monthString = "01"; break; case 2: monthString = "02"; break; case 3: monthString = "03"; break; case 4: monthString = "04"; break; case 5: monthString = "05"; break; case 6: monthString = "06"; break; case 7: monthString = "07"; break; case 8: monthString = "08"; break; case 9: monthString = "09"; break; case 10: monthString = "10"; break; case 11: monthString = "11"; break; case 12: monthString = "12"; break; default: // do nothing; } return monthString; } function setTodaysDate(){ var todaysDateString = todaysDate.getDate() + '/' + getMonthString(todaysDate.getMonth()+1) + '/' + todaysDate.getFullYear(); document.getElementById('todaysDate').innerHTML =todaysDateString; document.getElementById('DateOfPurchase').value = todaysDateString; } Can someone point me in the right direction please? Hi, I need to add days to a date in javascript, My requirement is as follows: Date is coming from a textbox. eg:- 26/07/2010 days from this statement var day1=document.getElementById('<%=HiddenDate.ClientID %>').value; an eg:- if the date is 28/01/2012 and days Needed to be added=5 the added date should be 02/02/2012. Can anybody help me? Thanks Jamuna Using Adobe Form Javascript validation, how would I do this code for Visual Basic in Javascript (non web) Code: If PurchaseDate.Value > Date Then MsgBox ("PurchaseDate cannot be greater than Today's Date!") Cancel = True End If Something along these lines but this isnt working: Code: If (PurchaseDate.Value > Date) Then { app.alert ("Purchase Date cannot be greater than Today's Date!"); } Thanks I have a drop down menu where people can select a month, day and year. Based on their selection, I want to show them an image. If their selection is >= July 26, 2010 but <= July 25, 2011, show the red image; If their selection is >= July 26, 2011 but <= July 25, 2012, show the white image; If their selection is >= July 26, 2012 but <= July 25, 2013, show the blue image; If their selection is >= July 26, 2013 but <= July 25, 2014, show the yellow image; I don't know how to compare a selected date to a range of dates like this. |