Hi

I have a web application written in ASP.NET C# and using SQL Server. I
am trying to select records with a date < a parameter.

In SQL:

@dtDateBefore datetime

SELECT ... WHERE [log].dateTimeLogged < @dtDateBefore

In C#:

System.TimeSpan diff1 = new System.TimeSpan(48, 0, 0);
System.DateTime today = System.DateTime.Now;
System.DateTime hrsAgo = today.Subtract(diff1);
dsOpenJobs.SelectParameters.Add("dtDateBefore",
TypeCode.DateTime ,hrsAgo.ToString ());

Trouble is, in ASP.NET my DateTime formats are dd/MM/yyyy. In SQL
server, they seem to be MM/dd/yyyy.

How can I get this to run correctly?

Stapes



Reply via email to