>>Thank you for both replies. What happens is that if the value of @TargetDate is NULL, all works.
>>Or if the value of @TargetDate from the XML type is American format (that works for many customers), all works.
>>But when I set the value in the ASP.NET application to the XML element TargetDate, I get error.
>>Why I do it this way is a long story. But it works for many years.
>>Now I need to figure where it breaks for the British date.
>
>"if the value of @TargetDate from the XML type is American format" - That is what I am saying, in the XML the format for a DateTime is fixed, regardless you are living in US or Turkey, or choose any place you like. It is like:
>
>2019-02-28T19:00:00+03:00
>
>I don't understand what does XML datetime have to do with ToShortTimeString(). Are you sure your XML is defining a DateTime type?
I see your point. But I can't find where I am messing up.
In short:
the XML is populated in the ASP.NET method. Where each element of the XML is a value. The problem is that when the value for the dreaded TARG_DATE is '13/02/2019 ...' (note 13!) somewhere my code looks at this as an american date. But there is no month 13. And the error comes from the stored procedure (which I described above). But even when I comment what I think is "offending" line in the stored procedure, I still get an error.
I am sure it is me.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham