Inline.
Paul
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Dean Cleaver
Sent: Monday, July 17, 2006 14:11
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Handling NZ Date Formats in SQL
I was thinking the same thing... Except 99% of the time, web
servers are in the same locale as their database - so if the
web server formats the date as aoűt there's a very good
chance that the database will accept that.
>> Yes, but you will get in trouble when formatting
your date's for a user with a locale that differs from the
web/db server, when you store a "date-string";
not to mention the trouble you can get yourself into when
trying to convert userinput to a valid date.
>> So rule of thumb, use a calendarcontrol to capture
userinput and store it in ISO format as the UTC date/time,
to prevent Daylight saving issues.
Failing that, I tend to pass dates as "yyyy-mm-dd
HH:mm:ss" as that's supposed to be an ISO or some
similar standard that all dbs are supposed to accept right?
>> Right
Dino
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Paul van Brenk
Sent: Monday, 17 July 2006 23:22
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Handling NZ Date Formats in SQL
I would use the month number instead of the short name: eg.
Yyyy-MM-dd, to avoid the confusion between aoűt and aug.
Paul
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Adrian Martin
Sent: Monday, July 17, 2006 10:24
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: [DOTNET-WEB] Handling NZ Date Formats in SQL
Could I just point out that using a format of "dd MMM
yyyy" when passing a date between differing cultured
systems makes things soooooo much easier, and solves so many
problems.
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of Jason Finch
Sent: 17-07-2006 07:54
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: Re: Handling NZ Date Formats in SQL
Hi David,
You may need to have a look at setting the cultureInfo See
this link, may help you get started
http://www.codeproject.com/dotnet/datetimeformat.asp
And
http://msdn.microsoft.com/library/defaul
t.asp?url=/library/en-us/cpguide
/html/cpcondatetimeformatstrings.asp
Or you could cheat and just pass it as a string in the
format you want, so something like:
string myDate =
DateTime.Now.ToString("MM/dd/yyyy")
-----Original Message-----
From: Discussion of building .NET applications targeted for
the Web [mailto OTNET-WE
B DISCUSS.DEVELOP.COM] On Behalf Of David Emerson
Sent: Monday, 17 July 2006 12:18 PM
To: DOTNET-WEB DISCUSS.DEVELOP.COM
Subject: [DOTNET-WEB] Handling NZ Date Formats in SQL
Listers,
I have been working through a tutorial for adding data to an
SQL2005 database using web pages.
One of the lines in the sample code is:
userQuizDataSource.InsertParameters.Add("DateTimeCompl
ete",
DateTime.Now.ToString())
When this is run it brings up an error saying it is having
trouble with converting a string to type datetime. I have
worked out the reason is that it is expecting US formated
dates, not NZ.
I also tried the following with the same result.:
userQuizDataSource.InsertParameters.Add("DateTimeCompl
ete",
DateTime.Now)
What is the way of ensuring the dates are in the correct
format
(mm/dd/yyyy) to bre inserted into a date field?
This correspondence is for the named persons only.
It may contain confidential or privileged information or
both.
No confidentiality or privilege is waived or lost by any mis
transmission.
If you receive this correspondence in error please delete it
from your system immediately and notify the sender.
You must not disclose, copy or relay on any part of this
correspondence, if you are not the intended recipient.
Any opinions expressed in this message are those of the
individual sender except where the sender expressly,
and with the authority, states them to be the opinions of
the Department of Emergency Services, Queensland.
===================================
This list is hosted by DevelopMentor(r) http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
Opinions expressed in this email are those of the writer
and not the company. E-mail traffic is monitored within
Johnston Press and messages may be viewed. This e-mail and
any files with it are solely for the use of the
addressee(s). If you are not the intended recipient, you
have received this e-mail in error. Please delete it or
return it to the sender or notify us by email at
postmaster jpress.co.uk
===================================
This list is hosted by DevelopMentorŽ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŽ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŽ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentorŽ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|