Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,922
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts

    Date-Day Calendar

    At one time I had a DOS program which enabled me to find the day of the week for any date from year 1800 or so onwards (and indeed into the future). Can anyone suggest a similar Windows program available nowadays?

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Yeah double click on the clock in your taskbar

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Flint, Michigan, USA
    Posts
    620
    Thanks
    1
    Thanked 20 Times in 20 Posts
    D=prompt('Date as MM/DD/YYYY','');
    D1=D.split('/');
    DayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    Now=new Date(D1[2],D1[0]-1,D1[1]);
    Now_D=Now.getDay();
    alert(DayNames[Now_D]);

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,922
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Originally posted by Nightfire
    Yeah double click on the clock in your taskbar
    This only starts from 1980. I need to go back to 1800.

  • #5
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    ahh, so it does

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,922
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Originally posted by jalarie
    D=prompt('Date as MM/DD/YYYY','');
    D1=D.split('/');
    DayNames=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    Now=new Date(D1[2],D1[0]-1,D1[1]);
    Now_D=Now.getDay();
    alert(DayNames[Now_D]);
    Does this work for the 19th century taking account of leap years etc?
    Last edited by Philip M; 02-19-2003 at 07:22 PM.

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,922
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts
    Thanks, Jalerie. Much obliged.

    First tests suggests that this works fine even for 19th century.

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    262
    Thanks
    0
    Thanked 0 Times in 0 Posts

    I saw this on a website

    <script LANGUAGE="JavaScript">
    <!-- Begin
    var D = "0";
    var M = "0";
    var Y = "0";
    var C = "0";
    var B = "0";
    var A = "0";
    var Day = "0";
    var Ending = "0";
    var Dayow = new Array();
    Dayow[-6] = "Monday";
    Dayow[-5] = "Tuesday";
    Dayow[-4] = "Wednesday";
    Dayow[-3] = "Thursday";
    Dayow[-2] = "Friday";
    Dayow[-1] = "Saturday";
    Dayow[0] = "Sunday";
    Dayow[1] = "Monday";
    Dayow[2] = "Tuesday";
    Dayow[3] = "Wednesday";
    Dayow[4] = "Thursday";
    Dayow[5] = "Friday";
    Dayow[6] = "Saturday";
    var mnth = new Array();
    mnth[0] = "January";
    mnth[1] = "February";
    mnth[2] = "March";
    mnth[3] = "April";
    mnth[4] = "May";
    mnth[5] = "June";
    mnth[6] = "July";
    mnth[7] = "August";
    mnth[8] = "September";
    mnth[9] = "October";
    mnth[10] = "November";
    mnth[11] = "December";
    function calcul() {
    if (document.calculate.mnth.options.value == 0 || document.calculate.day.options.value == 0 || document.calculate.year.value.length == 0) {
    alert('Please complete all options');
    }
    else if (document.calculate.mnth.options.value == 2 && document.calculate.day.options.value == 30 || document.calculate.mnth.options.value == 2 && document.calculate.day.options.value == 31) {
    alert('That Month does not have '+ document.calculate.day.options.value +' days');
    }
    else if (document.calculate.mnth.options.value == 4 && document.calculate.day.options.value == 31) {
    alert('That month does not have '+ document.calculate.day.options.value +' days');
    }
    else if (document.calculate.mnth.options.value == 6 && document.calculate.day.options.value == 31) {
    alert('That month does not have '+ document.calculate.day.options.value +' days');
    }
    else if (document.calculate.mnth.options.value == 9 && document.calculate.day.options.value == 31) {
    alert('That month does not have '+ document.calculate.day.options.value +' days');
    }
    else if (document.calculate.mnth.options.value == 11 && document.calculate.day.options.value == 31) {
    alert('That month does not have '+ document.calculate.day.options.value +' days');
    }
    else {
    calcul2();
    }
    }
    function calcul2() {
    D = document.calculate.day.options.value;
    M = document.calculate.mnth.options.value;
    Y = document.calculate.year.value;
    if (M < 3) {
    M = ((M / 1) + 12);
    Y = (Y - 1);
    date2();
    }
    else {
    date2();
    }
    }
    function date2() {
    C = (parseInt(Y / 100));
    B = (Y - (100 * C));
    A = ((parseInt((2.6 * M) - 5.39)) + (parseInt(B / 4)) + (parseInt(C / 4)) + (D / 1) + B - (2 * C));
    Day = (A - (7 * (parseInt(A / 7))));
    Leap = ((Y / 4) - (parseInt(Y / 4)));
    if (Leap != 0 && M >= 3 && A < 0) {
    Day =- -Day;
    daycalcu();
    }
    else if (Leap == 0 && M < 3 && A < 0) {
    Day = (Day - 2);
    daycalcu();
    }
    else {
    daycalcu();
    }
    }
    function daycalcu() {
    if (document.calculate.mnth.options.value == 2 && document.calculate.day.options.value == 29 && Leap == 0) {
    alert('February does not have '+ document.calculate.day.options.value +' days in '+ document.calculate.year.value +'');
    }
    else {
    appear();
    }
    }
    function appear() {
    if (document.calculate.day.options.value == 1 || document.calculate.day.options.value == 21 || document.calculate.day.options.value == 31) {
    Ending = "st";
    appear2();
    }
    else if (document.calculate.day.options.value == 2 || document.calculate.day.options.value == 22) {
    Ending = "nd";
    appear2();
    }
    else if (document.calculate.day.options.value == 3 || document.calculate.day.options.value == 23) {
    Ending = "rd";
    appear2();
    }
    else {
    Ending ="th";
    appear2();
    }
    }
    function appear2() {
    test = new Date();
    gdate = test.getDate();
    gyear = test.getFullYear();
    gmonth = test.getMonth();
    E = (gmonth + 1);
    D = document.calculate.day.options.value;
    M = document.calculate.mnth.options.value;
    Y = document.calculate.year.value;
    F = (M - 1);
    if (gyear == Y && gdate == D && E == M) {
    alert('The '+ document.calculate.day.options.value + Ending +' of '+ mnth[F] +' '+ document.calculate.year.value +' is a '+ Dayow[Day] +'');
    }
    else if (gyear < Y || gyear == Y && E < M || gyear == Y && E == M && gdate < D) {
    alert('The '+ document.calculate.day.options.value + Ending +' of '+ mnth[F] +' '+ document.calculate.year.value +' will be a '+ Dayow[Day] +'');
    }
    else if (gyear > Y || gyear == Y && E > M || gyear == Y && E == M && gdate > D) {
    alert('The '+ document.calculate.day.options.value + Ending +' of '+ mnth[F] +' '+ document.calculate.year.value +' was a '+ Dayow[Day] +'');
    }
    else {
    alert('The '+ document.calculate.day.options.value + Ending +' of '+ mnth[F] +' '+ document.calculate.year.value +' was a '+ Dayow[Day] +'');
    }
    }
    // End -->
    </script>


    <form name="calculate">
    <p><select name="day" size="1">
    <option>Choose Date </option>
    <option value="1">1st </option>
    <option value="2">2nd </option>
    <option value="3">3rd </option>
    <option value="4">4th </option>
    <option value="5">5th </option>
    <option value="6">6th </option>
    <option value="7">7th </option>
    <option value="8">8th </option>
    <option value="9">9th </option>
    <option value="10">10th </option>
    <option value="11">11th </option>
    <option value="12">12th </option>
    <option value="13">13th </option>
    <option value="14">14th </option>
    <option value="15">15th </option>
    <option value="16">16th </option>
    <option value="17">17th </option>
    <option value="18">18th </option>
    <option value="19">19th </option>
    <option value="20">20th </option>
    <option value="21">21st </option>
    <option value="22">22nd </option>
    <option value="23">23rd </option>
    <option value="24">24th </option>
    <option value="25">25th </option>
    <option value="26">26th </option>
    <option value="27">27th </option>
    <option value="28">28th </option>
    <option value="29">29th </option>
    <option value="30">30th </option>
    <option value="31">31st </option>
    </select> <select name="mnth" size="1">
    <option>Choose Month </option>
    <option value="1">January </option>
    <option value="2">February </option>
    <option value="3">March </option>
    <option value="4">April </option>
    <option value="5">May </option>
    <option value="6">June </option>
    <option value="7">July </option>
    <option value="8">August </option>
    <option value="9">September </option>
    <option value="10">October </option>
    <option value="11">November </option>
    <option value="12">December </option>
    </select> <input type="text" name="year" size="4" maxlength="4"> Year <br>
    <input type="button" value="Calculate" onclick="calcul()"> </p>
    </form>

    Rather cool.
    Therapy is expensive, popping bubble wrap is cheap, you choose.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •