Home All Groups Group Topic Archive Search About

Help on ASP SQL date format problem



Author
22 Mar 2006 9:59 AM
mewanalwis
Dear Friends,

I have a rather strange problem which invloves SQL server and ASP. The
problem is this.


I have an ASP application which use a SQL server. it saves date values
with MM/dd/yyyy format. the SQL server and every other computer is
configured to MM/dd/yyyy format in reginol settings. The DSN which use
to connect to SQL server is configured to use Reginol settings date
format.


But I for ex. when I save date 03/01/2006 (MM/dd/yyyy) using the
computer which runs sql server it saves right. But when I use other
computer it saves as 01/03/2006.


I'm really stuck in this mess. Please help me on this. Thank you.


Mewan
Sri Lanka

Author
22 Mar 2006 10:05 AM
Evertjan.
wrote on 22 mrt 2006 in microsoft.public.inetserver.asp.general:
Show quote
> I have a rather strange problem which invloves SQL server and ASP. The
> problem is this.
>
>
> I have an ASP application which use a SQL server. it saves date values
> with MM/dd/yyyy format. the SQL server and every other computer is
> configured to MM/dd/yyyy format in reginol settings. The DSN which use
> to connect to SQL server is configured to use Reginol settings date
> format.
>
>
> But I for ex. when I save date 03/01/2006 (MM/dd/yyyy) using the
> computer which runs sql server it saves right. But when I use other
> computer it saves as 01/03/2006.

No,No,no.

Dates saved in most databases in a date/time field are saved in an internal
numeric structure.

The only dependable date-litteral input to an sql string is #yyyy/mm/dd#
and the databse output should be put in a date variable where the
serverside script can extract d, m and y from.


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Author
22 Mar 2006 10:20 AM
mewanalwis
Dear Evertjan,
Thanks for your quick reply.

Thw thing is I don't specify any date format when i'm saving or editing
data. And the other thing is I simply enter the date in a asp  text box
in MM/dd/yyyy format. do i have to type it in yyyy/mm/dd format. Thank
you.

Mewan
Author
22 Mar 2006 2:23 PM
Evertjan.
wrote on 22 mrt 2006 in microsoft.public.inetserver.asp.general:
> Thw thing is I don't specify any date format when i'm saving or editing
> data.

That is what I said, databases do NOT store data in a readable format.

> And the other thing is I simply enter the date in a asp  text box

Asp text boxes do not exist, as ASP is serverside only.

Maybe in asp.net, but if that is what you mean
you are posting in the wrong NG.
This is a classic ASP only NG.

> in MM/dd/yyyy format. do i have to type it in yyyy/mm/dd format.

No, you are the programmer, and between the form-posting and the entry in
the database, you put your own conversion code.



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Author
22 Mar 2006 10:21 AM
mewanalwis
Dear Evertjan,
Thanks for your quick reply.

Thw thing is I don't specify any date format when i'm saving or editing
data. And the other thing is I simply enter the date in a asp  text box
in MM/dd/yyyy format. do i have to type it in yyyy/mm/dd format. Thank
you.

Mewan
Author
22 Mar 2006 12:51 PM
Bob Barrows [MVP]
mewanal***@hotmail.com wrote:
> Dear Evertjan,
> Thanks for your quick reply.
>
> Thw thing is I don't specify any date format when i'm saving or
> editing data. And the other thing is I simply enter the date in a asp
> text box in MM/dd/yyyy format. do i have to type it in yyyy/mm/dd
> format. Thank you.
>
http://www.aspfaq.com/show.asp?id=2313
http://www.aspfaq.com/show.asp?id=2040
http://www.aspfaq.com/show.asp?id=2260

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

AddThis Social Bookmark Button