Hi,
I had problems with dates and times too! Once, I managed to make it
work and when
I moved my app to another server It didn't work because of different
locale settings.
So here is my idea : leave the locale away, use some independent string
dates!
I will attach an example also, but it is very simple. O sql ask for a string
field, returned in a
well known and locale independent format!
The Date(string) seems to call internally the Date.parse(string) static
method.
Date.parse(string) will allways understand the 'mm/dd/yyyy' and the 'mm/dd/yyyy
hh:mm:ss'
date formats, whatever locale you have ! It works also in MS IE client JScript
code!
Here it is an example :
var rs=sqlConn.Execute("SELECT CONVERT(varchar,GETDATE(),101) AS TODAY");
var dt_str=rs("TODAY").Value;
var dt_obj=new Date(dt_str); // or new Date(Date.parse(dt_str));
Response.Write(dt_obj.toLocaleString());
bottom line,
if you need a date only string use CONVERT(varchar,DATE_FIELD,101)
if you need a date time string use CONVERT(varchar,GETDATE(),101)+'
'+CONVERT(varchar,GETDATE(),108)
Good Luck!
Regards,
Marius Manolea
""Brinkman, Theodore"" <[EMAIL PROTECTED]> wrote in
message FE8510398BFE854F9653B5C32DBB652FD4F2C3@oh_daytn_xch01">news:FE8510398BFE854F9653B5C32DBB652FD4F2C3@oh_daytn_xch01...
> Let me preface this request by saying that I know this request for help
> isn't quite on-topic, but I haven't found any good places to ask for help
on
> this. Thank you for not flogging me with wet noodles.
>
> Now, on to the question:
> We're having some problems relating to using MS SQL Server 2000 with a
> JavaScript ASP page. (Like I said, seriously ot here.)
>
> We get a datetime value from the database, and need to format it. From
what
> I've been told by the others in the project, they've tried everything they
> can think of to get the SQL Server datetime value stuffed into a
JavaScript
> Date object, but JavaScript doesn't seem to be willing to accept it.
We're
> currently parsing it out by hand, but the code to do so is fugly to say
the
> least.
>
> Anybody here know how to get around this?
>
> - Theo
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
begin 666 date.asp
M/"5 3$%.1U5!1T4]2E-#4DE05"4^#0H\:'1M;#X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T;TQO8V%L95-T<FEN9R@I*R(G/&)R/EQN(BD[#0H)
M4F5S<&]N<V4N5W)I=&4H(CPO<')E/EQN/"]P/EQN(BD[#0H)<W%L0V]N;BY#
M;&][EMAIL PROTECTED]*?0T*"6-A=&-H*&5R<BD-"@E[#0H)"65R<F]R/71R=64[#0H)
M"5)E<W!O;G-E+D-L96%R*"D[#0H)"5)E<W!O;G-E+E=R:71E*")%<G)O<B Z
M("(K97)R+F1E<V-R:7!T:6]N*3L-"@E]#0II9BAE<G)O<BD-"GL-"@E397-S
M:6]N+D%B86YD;VXH*3L-"@E297-P;VYS92Y%;F0H*3L-"GT-"F5L<V4-"GL-
M"B4^#0H\<#X\8G(^/"]P/@T*/&@Q/D-L:65N="!S:61E('-T=69F("XN+CPO
M:#$^#0H\<#X-"CQP<F4^#0H\4T-225!4($Q!3D=504=%/4I30U))4%0^#0HO
M*D!C8U]O;D J+PT*"79A<B!D=%]S='(](CPE/61T7W-T<B4^(CL-"@EV87(@
M9'1?;V)J/6YE=R!$871E*&1T7W-T<BD[#0H):68H0%]J<V-R:7!T7W9E<G-I
M;VX]/4!?:G-C<FEP=%]V97)S:6]N*0T*"0ED;V-U;65N="YW<FET92@B2E-C
M<FEP="!V97)S:6]N(&ES(" @(" @(" @(" @.B B*T!?:G-C<FEP=%]V97)S
M:6]N*R(\8G(^7&XB*3L-"@ED;V-U;65N="YW<FET92@-"@D)(E1H92!N97<@
M1&%T92@G(BMD=%]S='(K(B<I(&ES(#H@)R(K#0H)"61T7V]B:BYT;TQO8V%L
M95-T<FEN9R@I*PT*"0DB)SQB<CY<;B(I.PT*/"]30U))4%0^#0H\+W!R93X-
D"CPO<#X-"CPE#0I]#0HE/@T*/"]B;V1Y/@T*/"]H=&UL/@T*
`
end
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]