473,378 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Date Question

KL
I am working on a problem and desperately need help!

I need to prompt a user for the numerical month of birth, day of birth and
year of birth and store it in varialbes and the use the variables to build a
date object. Then print the resulting date object, in it's full form. on
the screen using document.write. This IS for school and I think I am
starting out right, but can't quite seem to grasp what I am doing wrong, or
where to go from here. Any tips would be greatly appreciated.

Here is what I have so far...

<script>
var mob=prompt("What is your month of birth, numerically?", "04");
var dob=prompt("What is the date of your birth, numerically?", "07");
var yob=prompt("What is the year of your birth, numerically?", "1967");
month.setMonth(mob-1);
day.setDate(dob);
year.setFullYear(yob);
document.write("Your birthday is " + date + "<br>");
</script>
KL
Jul 23 '05 #1
16 2069
Lee
KL said:

I am working on a problem and desperately need help!

I need to prompt a user for the numerical month of birth, day of birth and
year of birth and store it in varialbes and the use the variables to build a
date object. Then print the resulting date object, in it's full form. on
the screen using document.write. This IS for school and I think I am
starting out right, but can't quite seem to grasp what I am doing wrong, or
where to go from here. Any tips would be greatly appreciated.

Here is what I have so far...

<script>
var mob=prompt("What is your month of birth, numerically?", "04");
var dob=prompt("What is the date of your birth, numerically?", "07");
var yob=prompt("What is the year of your birth, numerically?", "1967");
month.setMonth(mob-1);
day.setDate(dob);
year.setFullYear(yob);
document.write("Your birthday is " + date + "<br>");
</script>


You want to have a single date object, not one each for month, day and year.
The easiest way to do that is to use the form of the Date() constructor that
takes month, day and year as arguments.

var date=new Date(...left for you to find...or ask about...);
document.write(...as you have it...);

Jul 23 '05 #2
KL
"Lee" <RE**************@cox.net> wrote in message
news:co*********@drn.newsguy.com...
KL said:

I am working on a problem and desperately need help!

I need to prompt a user for the numerical month of birth, day of birth and
year of birth and store it in varialbes and the use the variables to build
a
date object. Then print the resulting date object, in it's full form. on
the screen using document.write. This IS for school and I think I am
starting out right, but can't quite seem to grasp what I am doing wrong,
or
where to go from here. Any tips would be greatly appreciated.

Here is what I have so far...

<script>
var mob=prompt("What is your month of birth, numerically?", "04");
var dob=prompt("What is the date of your birth, numerically?", "07");
var yob=prompt("What is the year of your birth, numerically?", "1967");
month.setMonth(mob-1);
day.setDate(dob);
year.setFullYear(yob);
document.write("Your birthday is " + date + "<br>");
</script>


You want to have a single date object, not one each for month, day and
year.
The easiest way to do that is to use the form of the Date() constructor
that
takes month, day and year as arguments.

var date=new Date(...left for you to find...or ask about...);
document.write(...as you have it...);


OK I have read and reread this and I think I get some of it. But I am
confused as to what a Date() Constructor is. I don't think we covered that
in class and I don't find it in my book...or I didn't look right..I will
look again, but in the meantime, what can someone tell me about the Date()
Constructor?

KL
Jul 23 '05 #3
KL wrote:
[...]
OK I have read and reread this and I think I get some of it. But I am
confused as to what a Date() Constructor is. I don't think we covered that
in class and I don't find it in my book...or I didn't look right..I will
look again, but in the meantime, what can someone tell me about the Date()
Constructor?


Try the following:

<script type="text/javascript">
var mob=prompt("What is your month of birth, numerically?","04");
var dob=prompt("What is the date of your birth, numerically?","07");
var yob=prompt("What is the year of your birth, numerically?","1967");

var bDay= new Date(yob,mob,dob);
alert(bDay);
</script>
--
Rob
Jul 23 '05 #4
KL

"RobG" <rg***@iinet.net.auau> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au...
KL wrote:
[...]
OK I have read and reread this and I think I get some of it. But I am
confused as to what a Date() Constructor is. I don't think we covered
that in class and I don't find it in my book...or I didn't look right..I
will look again, but in the meantime, what can someone tell me about the
Date() Constructor?


Try the following:

<script type="text/javascript">
var mob=prompt("What is your month of birth, numerically?","04");
var dob=prompt("What is the date of your birth, numerically?","07");
var yob=prompt("What is the year of your birth, numerically?","1967");

var bDay= new Date(yob,mob,dob);
alert(bDay);
</script>
--
Rob


Thanks Rob...that helped immensely. I get what I was doing wrong. And best
of all it works now :)

KL
Jul 23 '05 #5
JRS: In article <41********@127.0.0.1>, dated Sat, 27 Nov 2004
23:06:24, seen in news:comp.lang.javascript, KL <kl*******@aohell.com>
posted :

"RobG" <rg***@iinet.net.auau> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au...
KL wrote:
[...]
OK I have read and reread this and I think I get some of it. But I am
confused as to what a Date() Constructor is. I don't think we covered
that in class and I don't find it in my book...or I didn't look right..I
will look again, but in the meantime, what can someone tell me about the
Date() Constructor?


Try the following:

<script type="text/javascript">
var mob=prompt("What is your month of birth, numerically?","04");
var dob=prompt("What is the date of your birth, numerically?","07");
var yob=prompt("What is the year of your birth, numerically?","1967");

var bDay= new Date(yob,mob,dob);
alert(bDay);
</script>
--
Rob


Thanks Rob...that helped immensely. I get what I was doing wrong. And best
of all it works now :)


You saw Rob's omission, then?
Moreover, note that by reading back (two of) the fields from bDay, you
can verify the date as being good Gregorian. Be careful, though, with
historical dates; William Penn's son John "The American", the first by
his second wife, was born on 1700-02-29. See sig below.

--
© 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.
Jul 23 '05 #6
Dr John Stockton wrote:
[..]

Moreover, note that by reading back (two of) the fields from bDay, you
can verify the date as being good Gregorian. Be careful, though, with
historical dates; William Penn's son John "The American", the first by
his second wife, was born on 1700-02-29. See sig below.


Yes, I forgot that. It is certainly an issue as different browsers
support different ranges.

I think the consensus was that since getFullYear() is not always
available, checking that the created date object's date and month were
equal to the input date and month was simplest (provided the OP
remembers to add one to the month...).

--
Rob
Jul 23 '05 #7
KL
"RobG" <rg***@iinet.net.auau> wrote in message
news:04*****************@news.optus.net.au...
Dr John Stockton wrote:
[..]

Moreover, note that by reading back (two of) the fields from bDay, you
can verify the date as being good Gregorian. Be careful, though, with
historical dates; William Penn's son John "The American", the first by
his second wife, was born on 1700-02-29. See sig below.

Yes, I forgot that. It is certainly an issue as different browsers
support different ranges.

I think the consensus was that since getFullYear() is not always
available, checking that the created date object's date and month were
equal to the input date and month was simplest (provided the OP
remembers to add one to the month...).


I remembered about the date offset of 1, but I am lost as to the other
issue. Can you really dumb it down for me?

KL
--
Rob

Jul 23 '05 #8
KL wrote:
"RobG" <rg***@iinet.net.auau> wrote in message
news:04*****************@news.optus.net.au...

[...]
Yes, I forgot that. It is certainly an issue as different browsers
support different ranges.

I think the consensus was that since getFullYear() is not always
available, checking that the created date object's date and month were
equal to the input date and month was simplest (provided the OP
remembers to add one to the month...).

I remembered about the date offset of 1, but I am lost as to the other
issue. Can you really dumb it down for me?


When you create a date object using year, month and day you may be
trying to create a date outside the range that the browser can handle.
Since you don't know what browser a user may be using, the easiest way
is to test the date you create against the input you created it from
(assuming you've validated that the input was OK in the first place,
that is that the year is a number, month is between 1 and 12 inclusive
and the day date between 1 and 31 inclusive).

Consider the following function:

function makeDate(y,m,d) {
var theDate = new Date(y,m-1,d);
return theDate;
}

Provided we call it with something like:

alert('The date is ' + makeDate('2003','0','5'));

we should get an alert telling us the date is 5 January, 2003. In some
browsers, (e.g. Safari) if we use:

alert('The date is ' + makeDate('1803','0','5'));

we'll get an error because it can't handle that dates before 1900 or
after 2038 (most other browsers can). So the best way to test is,
after creating our date, to use:

if(theDate.getMonth() != m || theDate.getDate() != d) {
alert('Can't handle date ' + y +'-' + m + '-' + d);
return false;
} else {
return theDate;
}

If you want to be really sure, add: || theDate.getFullYear() != y

However, getFullYear() may not be implemented and rather than messing
around with testing if it is or not, then seeing if the year is less
than 1900 then adding 1900, just don't test the year. The chance that
the month and date will be OK but year incorrect is pretty slim (in
this particular case).

Having said that, if you are going to use getFullYear(), you must test
that the browser supports it first and if not, use some alternative
(say use getYear() and if it returns a value less than 1900, add 1900).

For more fun, follow the link in Dr J's signature:

<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates,
sources.

--
Rob
Jul 23 '05 #9
KL
"RobG" <rg***@iinet.net.auau> wrote in message
news:gV*****************@news.optus.net.au...
KL wrote:
"RobG" <rg***@iinet.net.auau> wrote in message
news:04*****************@news.optus.net.au...

[...]
Yes, I forgot that. It is certainly an issue as different browsers
support different ranges.

I think the consensus was that since getFullYear() is not always
available, checking that the created date object's date and month were
equal to the input date and month was simplest (provided the OP
remembers to add one to the month...).

I remembered about the date offset of 1, but I am lost as to the other
issue. Can you really dumb it down for me?


When you create a date object using year, month and day you may be
trying to create a date outside the range that the browser can handle.
Since you don't know what browser a user may be using, the easiest way
is to test the date you create against the input you created it from
(assuming you've validated that the input was OK in the first place,
that is that the year is a number, month is between 1 and 12 inclusive
and the day date between 1 and 31 inclusive).

Consider the following function:

function makeDate(y,m,d) {
var theDate = new Date(y,m-1,d);
return theDate;
}

Provided we call it with something like:

alert('The date is ' + makeDate('2003','0','5'));

we should get an alert telling us the date is 5 January, 2003. In some
browsers, (e.g. Safari) if we use:

alert('The date is ' + makeDate('1803','0','5'));

we'll get an error because it can't handle that dates before 1900 or
after 2038 (most other browsers can). So the best way to test is,
after creating our date, to use:

if(theDate.getMonth() != m || theDate.getDate() != d) {
alert('Can't handle date ' + y +'-' + m + '-' + d);
return false;
} else {
return theDate;
}

If you want to be really sure, add: || theDate.getFullYear() != y

However, getFullYear() may not be implemented and rather than messing
around with testing if it is or not, then seeing if the year is less
than 1900 then adding 1900, just don't test the year. The chance that
the month and date will be OK but year incorrect is pretty slim (in
this particular case).

Having said that, if you are going to use getFullYear(), you must test
that the browser supports it first and if not, use some alternative
(say use getYear() and if it returns a value less than 1900, add 1900).

For more fun, follow the link in Dr J's signature:

<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates,
sources.

--
Rob


Thanks for that! I am learning so much!!

KL
Jul 23 '05 #10
JRS: In article <04*****************@news.optus.net.au>, dated Mon, 29
Nov 2004 00:29:48, seen in news:comp.lang.javascript, RobG
<rg***@iinet.net.auau> posted :
Dr John Stockton wrote:
[..]

Moreover, note that by reading back (two of) the fields from bDay, you
can verify the date as being good Gregorian. Be careful, though, with
historical dates; William Penn's son John "The American", the first by
his second wife, was born on 1700-02-29. See sig below.

Yes, I forgot that. It is certainly an issue as different browsers
support different ranges.


If so, they should be sorted into byte order and recycled!

The ECMA standard requires a range of 10^8 days, or possibly one less,
from 1970-01-01.

I think the consensus was that since getFullYear() is not always
available, checking that the created date object's date and month were
equal to the input date and month was simplest (provided the OP
remembers to add one to the month...).


The following function should return the full year, for all dates and
browsers; but I've not tested it browsers-wide :-

function getFY(D) { var YE
YE = Math.round(D.getTime() / 31556952000) + 1970
return YE + (D.getYear()-YE)%100 }

The principle is that, since the lengths of years do not vary greatly,
YE will always be correct within perhaps a day; and that the use of
getYear() will put the last two digits of the year correct.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)
Jul 23 '05 #11
JRS: In article <41******@127.0.0.1>, dated Sun, 28 Nov 2004 21:46:32,
seen in news:comp.lang.javascript, KL <kl*******@aohell.com> posted :
Dr John Stockton wrote:
[..]

Moreover, note that by reading back (two of) the fields from bDay, you
can verify the date as being good Gregorian. Be careful, though, with
historical dates; William Penn's son John "The American", the first by
his second wife, was born on 1700-02-29. See sig below.
I remembered about the date offset of 1, but I am lost as to the other
issue. Can you really dumb it down for me?


John Penn was born on the Julian Calendar; and so was everyone born in
the British Empire / Colonies before 1752-09-14 Gregorian. The
particular date that he chose to appear exists in the Julian Calendar,
but not the Gregorian. The javascript date object code treats the
Gregorian calendar as valid over the whole range. For Julian calendar
methods, see <URL:http://www.merlyn.demon.co.uk/js-date8.htm#JCDM>.

I seek further interesting events of that date, other than the death of
Samuel Lathrop.

--
© 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.
Jul 23 '05 #12
JRS: In article <gV*****************@news.optus.net.au>, dated Mon, 29
Nov 2004 04:51:24, seen in news:comp.lang.javascript, RobG
<rg***@iinet.net.auau> posted :
When you create a date object using year, month and day you may be
trying to create a date outside the range that the browser can handle.
Since you don't know what browser a user may be using, the easiest way
is to test the date you create against the input you created it from
(assuming you've validated that the input was OK in the first place,
that is that the year is a number, month is between 1 and 12 inclusive
and the day date between 1 and 31 inclusive).
I do not believe that the parenthesised validation is needed, at least
in a proper browser. One can shovel any old rubbish into new Date(Y, M,
D), and it will store NaN unless the stuff converts to a date within
range ( > +-200000 years ); if M or D is outside range, a value of
milliseconds is stored corresponding to YMD. Date methods return NaN if
the object holds NaN; and NaN is unequal to anything, even another NaN.

The only caveat concerns entering years 00..99, which may be interpreted
as 1900-1999; that makes a difference only for A.D. 0, which for error
rectification was not Leap so it's actually right, but A.D. 4 was
likewise not Leap --- but for dates before 1582-10-15 one must want the
Julian Rules anyway.

Having said that, if you are going to use getFullYear(), you must test
that the browser supports it first and if not, use some alternative
(say use getYear() and if it returns a value less than 1900, add 1900).
Not completely reliable. I have been assured that in at least one
system the method getYear will return 4 for the current year -
recorded in js-date0.htm#gY - can anyone name such browsers?

<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates,
sources.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
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 js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #13
JRS: In article <41******@127.0.0.1>, dated Mon, 29 Nov 2004 07:28:45,
seen in news:comp.lang.javascript, KL <kl*******@aohell.com> posted :
Lines: 79 "RobG" <rg***@iinet.net.auau> wrote in message
news:gV*****************@news.optus.net.au...
...

Thanks for that! I am learning so much!!


Do, though, learn FAQ section 2.3, including the first part of para 6.

--
© 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.
Jul 23 '05 #14
JRS: In article <gV*****************@news.optus.net.au>, dated Mon, 29
Nov 2004 04:51:24, seen in news:comp.lang.javascript, RobG
<rg***@iinet.net.auau> posted :
In some
browsers, (e.g. Safari) if we use:

alert('The date is ' + makeDate('1803','0','5'));

we'll get an error because it can't handle that dates before 1900 or
after 2038 (most other browsers can).

In IE4, the following test code, executed (in my js-quick.htm), shows
(without perceptible delay)

8639999999999990 Sat Sep 13 00:59:59 UTC+0100 275760
-8639999999999990 Tue Apr 20 01:00:00 UTC+0100 271822 B.C.

What do other browsers give? Do any fail?

B1 = 0 ; B2 = +1e20
do { T = (B1+B2)/2
isNaN(new Date(T)) ? B2 = T : B1 = T } while (B2-B1>50)
document.write(T, ' ', new Date(T))
document.write('<br>')
B1 = 0 ; B2 = -1e20
do { T = (B1+B2)/2
isNaN(new Date(T)) ? B2 = T : B1 = T } while (B1-B2>50)
document.write(T, ' ', new Date(T))
The 2038 limitation is presumably to 2038-01-19 Tue 03:14:07 GMT which
is 1970-01-01 + 2^31 - 1 ms.

But 1970-01-01 - 2^31 ms is 1901-12-13 Fri 20:45:52 GMT, which suggests
that your statement may be under-pessimistic.

Given the possible use of script to calculate 30-year mortgages, failure
for 2038 could bite fairly soon.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
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 js-dates.htm pas-time.htm critdate.htm etc.
Jul 23 '05 #15
Dr John Stockton wrote:
[...]
In IE4, the following test code, executed (in my js-quick.htm), shows
(without perceptible delay)

8639999999999990 Sat Sep 13 00:59:59 UTC+0100 275760
-8639999999999990 Tue Apr 20 01:00:00 UTC+0100 271822 B.C.

What do other browsers give? Do any fail?

B1 = 0 ; B2 = +1e20
do { T = (B1+B2)/2
isNaN(new Date(T)) ? B2 = T : B1 = T } while (B2-B1>50)
document.write(T, ' ', new Date(T))
document.write('<br>')
B1 = 0 ; B2 = -1e20
do { T = (B1+B2)/2
isNaN(new Date(T)) ? B2 = T : B1 = T } while (B1-B2>50)
document.write(T, ' ', new Date(T))
The 2038 limitation is presumably to 2038-01-19 Tue 03:14:07 GMT which
is 1970-01-01 + 2^31 - 1 ms.

But 1970-01-01 - 2^31 ms is 1901-12-13 Fri 20:45:52 GMT, which suggests
that your statement may be under-pessimistic.
Yes, but I was not concerned about exactitude, more just making the
point that one should always check that generated dates are correct and
not just rely on whoever wrote the JS date function for whatever
browser the user may chose to use.

However, since you brought it up... the following results are from
Safari 1.2.3 on Mac OS 10.3.

Your guestimate is almost correct. Using the 'js-quick' script gave
without perceptible delay:

100000000000000000000 Tue Jan 19 2038 13:14:07 GMT+1000
-100000000000000000000 Sat Dec 14 1901 06:45:52 GMT+1000

Manual testing confirmed the limits as:

1901-12-14 06:45:52 to 2038-01-19 13:14:07

I think the timezone is irrelvant, I've left it in for comleteness.

Given that KHTML (on which Safari is based) claims to be ECMA
compliant, I can only presume this is a quirk of Safari since I have no
resources to test KHTML.

The spec requires a range of approximately 285,616 years either side of
01 January, 1970. Clearly Safari fails in this case.

As for other browsers, the following are all on Mac OS X 10.2.8:

*Camino 0.8.1* *Firefox 1.0* *Netscape 7.2* *Opera 6.03*

8639999999999990 Sat Sep 13 275760 09:59:59 GMT+1000 (EST)
-8639999999999990 Tue Apr 20 -271821 10:00:00 GMT+1000 (EST)
*IE 5.2* varied slightly in format only:

8639999999999990 Sat Sep 13 09:59:59 UTC+1000 275760
-8639999999999990 Tue Apr 20 10:00:00 UTC+1000 271822 B.C.

Given the possible use of script to calculate 30-year mortgages, failure
for 2038 could bite fairly soon.


Yes. I've posted at Apple's support discussions to find an answer.

--
Fred
Jul 23 '05 #16
JRS: In article <41ac70aa$0$25788$5a62ac22@per-qv1-newsreader-
01.iinet.net.au>, dated Tue, 30 Nov 2004 23:07:33, seen in
news:comp.lang.javascript, Fred Oz <oz****@iinet.net.auau> posted :

Yes, but I was not concerned about exactitude, more just making the
point that one should always check that generated dates are correct and
not just rely on whoever wrote the JS date function for whatever
browser the user may chose to use.

However, since you brought it up... the following results are from
Safari 1.2.3 on Mac OS 10.3.

Your guestimate is almost correct. Using the 'js-quick' script gave
without perceptible delay:

100000000000000000000 Tue Jan 19 2038 13:14:07 GMT+1000
-100000000000000000000 Sat Dec 14 1901 06:45:52 GMT+1000

Manual testing confirmed the limits as:

1901-12-14 06:45:52 to 2038-01-19 13:14:07

I think the timezone is irrelvant, I've left it in for comleteness.
No; if you choose to live 10 hours ahead of GMT, you should recognise
the consequences ! Those, and those below, are in exact agreement with
what I expected, allowing for the milliseconds of uncertainty in the
method. Are you a horse rider and anywhere near Glen Innes / Armidale?

Given that KHTML (on which Safari is based) claims to be ECMA
compliant, I can only presume this is a quirk of Safari since I have no
resources to test KHTML.

The spec requires a range of approximately 285,616 years either side of
01 January, 1970. Clearly Safari fails in this case.
It seems rather likely that they've used a "C" date/time package, using
time_t as a signed 31-bit 1970-based integer. That might explain why
the big numbers are "exact" above, which is *mildly* surprising; the
Date Object might not support milliseconds.

As for other browsers, the following are all on Mac OS X 10.2.8:

*Camino 0.8.1* *Firefox 1.0* *Netscape 7.2* *Opera 6.03*

8639999999999990 Sat Sep 13 275760 09:59:59 GMT+1000 (EST)
-8639999999999990 Tue Apr 20 -271821 10:00:00 GMT+1000 (EST)
Illustrates the ambiguity of EST.
*IE 5.2* varied slightly in format only:

8639999999999990 Sat Sep 13 09:59:59 UTC+1000 275760
-8639999999999990 Tue Apr 20 10:00:00 UTC+1000 271822 B.C.


I've put the code, modified to show GMT/UTC & astronomical notation, in
<URL:http://www.merlyn.demon.co.uk/js-date0.htm#SDB>. If I hear that it
ever breaks the page, I'll need to change it.

--
© 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.
Jul 23 '05 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mirza i | last post by:
thanks for the previous replies. here is the new question (i'm absolutely sure that this should be VERY easy for a good js coder) ok: from asp i call: <img src="pics/cal.gif"...
12
by: Steve Elliott | last post by:
I have a query set up to gather together data between two specified dates. Shown in the query column as: Between #24/09/2004# And #01/10/2004# Is it possible to enter several different date...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
10
by: dan | last post by:
Am i breaking any rules when I loop dates like // Determine Memorial Day intFlag = 0; memDayHol = new Date (currentYear, 4, 31); while (intFlag == 0) { if (memDayHol.getDay() == 1) {intFlag...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might be
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.