Javascript countdown: editing?

Discussion in 'Javascript' started by Dirntknow, Jun 29, 2007.

  1. Dirntknow

    Dirntknow Guest

    I've found this link to a countdown timer i'd like to use but although I can
    get it to view correctly in my website i'm not sure what to edit for a
    different date. What do i change for it to count down to 10:00am 15th August
    for example?

    Thanks...Andre
    Dirntknow, Jun 29, 2007
    #1
    1. Advertising

  2. Dirntknow

    Lee Guest

    Dirntknow said:
    >
    >I've found this link to a countdown timer i'd like to use but although I can
    >get it to view correctly in my website i'm not sure what to edit for a
    >different date. What do i change for it to count down to 10:00am 15th August
    >for example?


    How can we tell you that without knowing exactly what code you're using?


    --
    Lee, Jun 29, 2007
    #2
    1. Advertising

  3. In comp.lang.javascript message <>, Fri, 29
    Jun 2007 10:32:24, Lee <> posted:
    >Dirntknow said:
    >>
    >>I've found this link to a countdown timer i'd like to use but although I can
    >>get it to view correctly in my website i'm not sure what to edit for a
    >>different date. What do i change for it to count down to 10:00am 15th August
    >>for example?

    >
    >How can we tell you that without knowing exactly what code you're using?


    Easily. One changes the date and time in the code to represent the date
    XXXX-08-15T10:00:00.000 in a suitable year.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
    Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
    PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
    Dates - miscdate.htm moredate.htm vb-dates.htm pas-time.htm critdate.htm etc.
    Dr J R Stockton, Jun 30, 2007
    #3
  4. Dirntknow

    Dirntknow Guest

    Dirntknow, Jun 30, 2007
    #4
  5. Dirntknow

    RobG Guest

    On Jul 1, 1:09 am, Dr J R Stockton <> wrote:
    > In comp.lang.javascript message <>, Fri, 29
    > Jun 2007 10:32:24, Lee <> posted:
    >
    > >Dirntknow said:

    >
    > >>I've found this link to a countdown timer i'd like to use but although I can
    > >>get it to view correctly in my website i'm not sure what to edit for a
    > >>different date. What do i change for it to count down to 10:00am 15th August
    > >>for example?

    >
    > >How can we tell you that without knowing exactly what code you're using?

    >
    > Easily. One changes the date and time in the code to represent the date
    > XXXX-08-15T10:00:00.000 in a suitable year.


    And watch it go belly-up in all browsers other than Opera. :-(

    While that format might be ISO correct, the best format (i.e.
    acceptable in a wide variety of browsers) for a date string I have
    found is:

    new Date( 'yyyy/mm/dd hh:mm:ss' );

    Attempting strict ISO compliance, time zones, or fractions of seconds
    is doomed I'm afraid in most browsers.

    Incidentally, if I create a date object in the future, say:

    var t = new Date( '2010/01/01 01:00:00' );
    alert( t.getTimezoneOffset() )

    will I see the offset for that date (which may or may not include an
    adjustment for daylight saving), or for when the code is run?

    It seems to me it *should* return the offset for that particular date,
    including daylight saving if known to be in force at that time. The
    ECMAScript Language specification doesn't really help here.


    --
    Rob
    RobG, Jul 1, 2007
    #5
  6. In comp.lang.javascript message <
    oglegroups.com>, Sat, 30 Jun 2007 21:42:58, RobG <>
    posted:
    >On Jul 1, 1:09 am, Dr J R Stockton <> wrote:
    >> In comp.lang.javascript message <>, Fri, 29
    >> Jun 2007 10:32:24, Lee <> posted:
    >>
    >> >Dirntknow said:

    >>
    >> >>I've found this link to a countdown timer i'd like to use but
    >> >>although I can
    >> >>get it to view correctly in my website i'm not sure what to edit for a
    >> >>different date. What do i change for it to count down to 10:00am
    >> >>15th August
    >> >>for example?

    >>
    >> >How can we tell you that without knowing exactly what code you're using?

    >>
    >> Easily. One changes the date and time in the code to represent the date
    >> XXXX-08-15T10:00:00.000 in a suitable year.

    >
    >And watch it go belly-up in all browsers other than Opera. :-(


    But I wrote "to represent"; I did not supply a prepared string. It
    needs to be done twice in that depressing code.


    >While that format might be ISO correct, the best format (i.e.
    >acceptable in a wide variety of browsers) for a date string I have
    >found is:
    >
    > new Date( 'yyyy/mm/dd hh:mm:ss' );


    I know I used to think that was safe, except maybe for years before 1000
    or 100. I don't know whether I'm quite so sure now.


    H'mm - in IE6, new Date( '11/11/11 11:11:11 ' ) is in year 1911
    but new Date( '11/11/11 11:11:11 AD' ) is in year 11

    and, expectedly, new Date( '22/11/22 11:11:11 AD ' ) is in year 23


    >Attempting strict ISO compliance, time zones, or fractions of seconds
    >is doomed I'm afraid in most browsers.
    >
    >Incidentally, if I create a date object in the future, say:
    >
    > var t = new Date( '2010/01/01 01:00:00' );
    > alert( t.getTimezoneOffset() )
    >
    >will I see the offset for that date (which may or may not include an
    >adjustment for daylight saving), or for when the code is run?


    It should be for that date, by current rules.


    >It seems to me it *should* return the offset for that particular date,
    >including daylight saving if known to be in force at that time. The
    >ECMAScript Language specification doesn't really help here.


    I thought it clear (ISO 16262 15.9.1.8). The Summer Time Rules which
    are currently valid should be applied for all dates past present and
    future, even if the OS could do "better". You've noticed the ECMA3 bug
    there?

    AFAIK, Vista is the first non-UNIX OS, or at least the first Windows, to
    store more than one set of date rules for a locality.

    If you've been following the US legislative situation, you'll know that
    the new US rules came into force on 2007-03-01. The legislation
    mentioned no time, so I suppose they mean at 00:00h local time.

    Therefore, Vista users in most of North America should have been able to
    see the value of +new Date("31 March 2007") change by 36e5 at the
    stroke of local midnight starting March 2007; and law-abiding US users
    of Windows and javascript should have installed their DST update at that
    instant in order to be able to do the same.


    Opera 9.21 has a Summer Time bug for some dates before 1970 and from
    2038, when run in UK. It should be tried in CA and AU.

    function X99() { var YY, Y, M, D, DOb, A
    A = ["Try exact dates in 11-year ranges; IE & FF are OK.\n" +
    "Opera 9.21 shows me errors near most Summer Time steps" +
    " except 1970-2037."]
    for (YY=1970 ; YY<2050 ; YY+=68) { A.push("")
    for (Y=YY-4 ; Y<YY+5 ; Y++) for (M=0 ; M<12 ; M++)
    for (D=0 ; D<32 ; D++) { DOb = new Date(Y, M, D)
    if (DOb.getHours()!=0) A.push(LZ(D) + " " + DOb) }
    }
    document.write(A.length>3 ? A.join("\n") : A[0] ) }

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6.
    Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
    PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
    Dates - miscdate.htm moredate.htm vb-dates.htm pas-time.htm critdate.htm etc.
    Dr J R Stockton, Jul 1, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ryan Stewart

    GUI countdown timer in a JApplet?

    Ryan Stewart, Dec 23, 2003, in forum: Java
    Replies:
    2
    Views:
    862
  2. vasilis

    Countdown

    vasilis, Aug 23, 2004, in forum: Java
    Replies:
    2
    Views:
    693
    Nick Pomfret
    Aug 23, 2004
  3. Replies:
    5
    Views:
    575
    Andrew Thompson
    Nov 30, 2004
  4. Replies:
    0
    Views:
    584
  5. fb
    Replies:
    2
    Views:
    326
    Dr J R Stockton
    Feb 2, 2008
Loading...

Share This Page