|
 |
asp_databases thread: problem with DATE in ASP with SQL server
Message #1 by mkrishna - Internet Mail <mkrishna@c...> on Tue, 22 Aug 2000 10:47:30 -0400
|
|
I have a field where I populate the date field with the system date, but the
date appears as 8/22/00
which is passed to my SQL as a parameter.
The problem is SQL server is strictly asking for DD/MM/YY, i.e insted of
8/22/00 I HAVE to give 08/22/00.
is there anyways I could make the server retrieve records even if its
8/22/00 omitting the 0 in the beginning.
any help is appreciated....
thanks
krish
Message #2 by Imar Spaanjaars <Imar@S...> on Tue, 22 Aug 2000 20:14:47 +0200
|
|
Here's wat Ken wrote a couple of days ago:
<ken quote>
Use the format: yyyy/mm/dd
It's easy to write a function to generate yyyy/mm/dd from a given dd/mm/yyyy
(or mm/dd/yyyy) and there's no ambiguity. As someone once told me: not even
the Americans are perverse enough to come up with a yyyy/dd/mm format :-)
Cheers
Ken
</ken quote>
Imar
At 10:47 AM 8/22/2000 -0400, you wrote:
>I have a field where I populate the date field with the system date, but the
>date appears as 8/22/00
>which is passed to my SQL as a parameter.
>
>The problem is SQL server is strictly asking for DD/MM/YY, i.e insted of
>8/22/00 I HAVE to give 08/22/00.
>is there anyways I could make the server retrieve records even if its
>8/22/00 omitting the 0 in the beginning.
>
>any help is appreciated....
>
>thanks
>
>krish
Message #3 by "Pat Waddington" <paw@s...> on Wed, 23 Aug 2000 08:50:01 +0100
|
|
Use a SPLIT statement to separate the system date into its component parts.
Check the length of the day and month and if either has a length of 1 add a
zero to the front. Then reassemble the date in the order you want it.
This works - my local system uses UK format but my hosting server uses
American. I have to do this all the time.
HTH
Pat
----- Original Message -----
From: mkrishna - Internet Mail
To: ASP Databases <asp_databases@p...>
Sent: Tuesday, August 22, 2000 3:47 PM
Subject: [asp_databases] problem with DATE in ASP with SQL server
> I have a field where I populate the date field with the system date, but
the
> date appears as 8/22/00
> which is passed to my SQL as a parameter.
>
> The problem is SQL server is strictly asking for DD/MM/YY, i.e insted of
> 8/22/00 I HAVE to give 08/22/00.
> is there anyways I could make the server retrieve records even if its
> 8/22/00 omitting the 0 in the beginning.
>
> any help is appreciated....
>
> thanks
>
> krish
>
>
|
|
 |