Re: ASP > SQL date problem!?
From: Evertjan. (exjxw.hannivoort_at_interxnl.net)
Date: 09/02/04
- Next message: Asp Help: "After changing security settings Post-method returns emty variables"
- Previous message: Jerome: "ASP > SQL date problem!?"
- In reply to: Jerome: "ASP > SQL date problem!?"
- Next in thread: Thomas Dodds: "Re: ASP > SQL date problem!?"
- Reply: Thomas Dodds: "Re: ASP > SQL date problem!?"
- Messages sorted by: [ date ] [ thread ]
Date: 02 Sep 2004 09:51:24 GMT
Jerome wrote on 02 sep 2004 in microsoft.public.inetserver.asp.general:
> 1. birthday field
> SQL server will only accept it if entered in MM/DD/YYYY.
No, the general accepted format is yyyy-mm-dd
> Which is bad
> since we're in Europe, people are accustomed to DD/MM/YYYY. I tried to
> use LCID but that didn't work either. Funny thing is when the birthday
> is entered in MM/DD/YYYY on the page, it later gets displayed as
> DD/MM/YYYY in SQL Server!?
SQL server does not "display"
> Which is good though! (It would be better
> of course if it could be entered in DD/MM/YYYY and be recorder in SQL
> as such)
In a database field with the type date(!!), as you are using here,
the date is stored as a number.
> 2. field with the current date & time
> The ASP page displays it correctly as 02/09/2004 (September 2nd). But
> SQL Server saves it as 09/02/2004 (February 9th).
You should "give" it to the SQL string as yyyy-mm-dd or yyyy/mm/dd
> And I bet there'll
> be an error or September 13th ... Or is there a way to define in SQL
> Server something similar to the Default Value: Now() in Access? Then I
> could drop this field on the ASP page.
Perhaps, I do not use SQL server. now() will probably include the actual
serverlocal time. I suspect that is not what you want.
But if you 'give' it to the db as a ASP string, convert your input to a
yyyy-mm-dd string
If you retrieve it from the databas, and it comes as mm/dd/yyyy, convert
it by ASP(vbs/jscript) to you preferred string.
> So somehow there's a complete confusion!?
>
> How can I streamline that or where on the Internet could I find more
> info about it?
Concluding:
Make two functions,
one converting your preferred date string to a yyyy-mm-dd string
and
one converting the database output string to your preferred date string.
-- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress, but let us keep the discussions in the newsgroup)
- Next message: Asp Help: "After changing security settings Post-method returns emty variables"
- Previous message: Jerome: "ASP > SQL date problem!?"
- In reply to: Jerome: "ASP > SQL date problem!?"
- Next in thread: Thomas Dodds: "Re: ASP > SQL date problem!?"
- Reply: Thomas Dodds: "Re: ASP > SQL date problem!?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|