List Info

Thread: help : how to resolve.




help : how to resolve.
user name
2006-10-12 22:00:47
It looks like IE and Firefox differ in their implementation
of the
Date.UTC function.  According to the Mozilla's Javascript
docs
(http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Re
ference:Global_Objectsate:UTC<
/a>)
the month parameter should be 0 based (0-11) but the date
should be 1
based (1 to 28-31).

Change return (Date.UTC(Y, M, D) - Date.UTC(Y, 0, 0)) /
86400000;
to return (Date.UTC(Y, M, D) - Date.UTC(Y, 0, 1)) /
86400000;
and the answers should be the consistent.

OraWiz wrote:
> Heres a bit of code taken out from a module I am
writting. The issue is
> the Day retured by IE and FFox are different how to
resolve it. Please
> help.
>
> <HTML>
> <HEAD>
> <TITLE> TEST</TITLE>
> </HEAD>
> <SCRIPT>
> function FDoY()
> {
> 	var dt = new Date();
>     var Y = dt.getFullYear(), M = dt.getMonth(), D =
dt.getDate();
>     return (Date.UTC(Y, M, D) - Date.UTC(Y, 0, 0)) /
86400000;
> }
> </SCRIPT>
> <BODY>
> <SCRIPT>
> document.write('Day  ...' + FDoY());
> </SCRIPT>
> </BODY>
> </HTML>
> 
> 
> Thanks in advance.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Google Homepage API" group.
To post to this group, send email to Google-Homepage-APIgooglegroups.com
To unsubscribe from this group, send email to
Google-Homepage-API-unsubscribegooglegroups.com
For more options, visit this group at ht
tp://groups.google.com/group/Google-Homepage-API
-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )