By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,569 Members | 1,181 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,569 IT Pros & Developers. It's quick & easy.

Birthday Calculators -

P: n/a
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

Oct 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
Oct 15 '05 #2

P: n/a
JRS: In article <11**********************@g49g2000cwa.googlegroups .com>
, dated Fri, 14 Oct 2005 17:18:19, seen in news:comp.lang.javascript,
justme <00****@gmail.com> 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.
Oct 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.