Birthday Calculators -

Discussion in 'Javascript' started by justme, Oct 15, 2005.

  1. justme

    justme Guest

    Hi - can someone help me please?

    I would like a countdown script which:

    a) is presented as a form to the user
    b) form has two date fields (today's date and upcoming event date)
    c) results field, in which the difference calculated is displayed.

    Results only need to be presented in DAYS format (i.e, don't need to
    display hours, minutes, seconds etc..)

    The second script I'm after, is a simple
    calculation-of-seconds-since-birth script - also in displayed as a form
    the user fills in their initial birth date/time details, results
    displayed in a "You are ..... seconds old"

    Thanking, in advance, anyone who can offer assistance.

    Wendy
     
    justme, Oct 15, 2005
    #1
    1. Advertising

  2. justme

    RobG Guest

    justme wrote:
    > Hi - can someone help me please?
    >
    > I would like a countdown script which:
    >
    > a) is presented as a form to the user
    > b) form has two date fields (today's date and upcoming event date)
    > c) results field, in which the difference calculated is displayed.
    >
    > Results only need to be presented in DAYS format (i.e, don't need to
    > display hours, minutes, seconds etc..)
    >
    > The second script I'm after, is a simple
    > calculation-of-seconds-since-birth script - also in displayed as a form
    > the user fills in their initial birth date/time details, results
    > displayed in a "You are ..... seconds old"
    >
    > Thanking, in advance, anyone who can offer assistance.


    The group faq:

    <URL:http://www.jibbering.com/faq/>

    provides a link that has everything you need for doing date calculations:

    <URL:http://www.merlyn.demon.co.uk/js-dates.htm>



    --
    Rob
     
    RobG, Oct 15, 2005
    #2
    1. Advertising

  3. JRS: In article <>
    , dated Fri, 14 Oct 2005 17:18:19, seen in news:comp.lang.javascript,
    justme <> posted :
    >Hi - can someone help me please?
    >
    >I would like a countdown script which:
    >
    >a) is presented as a form to the user
    >b) form has two date fields (today's date and upcoming event date)
    >c) results field, in which the difference calculated is displayed.
    >
    >Results only need to be presented in DAYS format (i.e, don't need to
    >display hours, minutes, seconds etc..)


    Use a method based on Zeller's Congruence or similar to convert Y M D to
    a DayCount; and subtract. Or use Date Objects, subtract, divide by
    864e5, and round to integer. Remember to validate the dates, if it
    matters.


    >The second script I'm after, is a simple
    >calculation-of-seconds-since-birth script - also in displayed as a form
    >the user fills in their initial birth date/time details, results
    >displayed in a "You are ..... seconds old"


    Cannot be done reliably. Javascript, like most OSs, has no knowledge of
    Summer Time rules other than the current ones; and in most locations the
    rules have changed since most people were born, or are about to change.
    You'd need to know the moment of birth in UTC.

    And they don't know about Leap Seconds either, so even UTC won't give
    the right answer unaided.

    Hoe many seconds old is a child born in Berlin on 2000-10-29 at 02:30
    local time, if it's now whatever time it is at your (unspecified)
    location?

    --
    © John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
    <URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
     
    Dr John Stockton, Oct 15, 2005
    #3
    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. CZ
    Replies:
    1
    Views:
    720
    Jack Li
    Sep 23, 2005
  2. dmoniac75
    Replies:
    0
    Views:
    1,242
    dmoniac75
    Mar 4, 2005
  3. Travis Newbury

    Happy birthday Travis!

    Travis Newbury, May 27, 2005, in forum: HTML
    Replies:
    1
    Views:
    439
  4. Sandra

    Birthday Problem

    Sandra, Apr 12, 2004, in forum: C++
    Replies:
    58
    Views:
    4,077
    Bruce Clement
    Apr 14, 2004
  5. Chris Stephens
    Replies:
    0
    Views:
    243
    Chris Stephens
    Mar 31, 2006
Loading...

Share This Page