Ok I found it out. Even when doing
date = date.ToString("yyyy-MM-dd HH:mm:ss");
the current thread culture is used for the separator. To force the separator
i used following syntax :
date = date.ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss");
Now it can be passed smoothly to sql as a sql convertible datetime.
Regards
Gilles
On Jun 8, 11:18 am, Faessler Gilles
<FaesslerGil...@discussions.microsoft.com> wrote:
> date = date.ToString("yyyy-MM-dd HH:mm:ss");
>
> Problem is that when I set my local settings to a format like "dd/MM/yyyy
> H.mm.ss" which gives for example "08.06.2007 0.00.00" and pass it to the
> normalize function it returns "08.06.2007 00.00.00 without changing the time
> separator.
Do you mean that
DateTime date = new DateTime().Parse("08.06.2007 0.00.00");
Response.Write(date.ToString("yyyy-MM-dd HH:mm:ss"));
returns:
------------------------------------------------
08.06.2007 0.00.00
?
Faessler Gilles - 08 Jun 2007 12:10 GMT
> On Jun 8, 11:18 am, Faessler Gilles
> <FaesslerGil...@discussions.microsoft.com> wrote:
[quoted text clipped - 17 lines]
>
> No it returns 08-06-2007 00.00.00 because it still uses the separator from the current thread culture. To force the separator i added '' around the separator
yyyy'-'MM'-'dd' 'HH':'mm':'ss