I am using datetimepicker to accept date from user. It is showing time with date. how can I extract date part from it. I am using following syntax but it is not working. DateTimePicker1.CustomFormat = "mm/dd/yy" SqlDataAdapter1.SelectCommand.Parameters("@param1").Value = DateTimePicker1.value DataSet91.Clear() SqlDataAdapter1.Fill(DataSet91) can somebody help me to extract date from datetimepicker. Thanks.
DateTimePicker1.Value.ToShortDateString 'this will return only the date while the time will be nopt displayed Code (markup):
Can You tell me the Simple and easy code for taking out the difference between two date in asp.net? Thanks in advance.
Can You tell me the Simple and easy code for taking out the difference between two date in asp.net? Thanks in advance.
SELECT <ColumnName> FROM <TableName> WHERE DateColumnName BETWEEN @DateFrom AND @DateTo DateFrom and DateTo are params and DateColumnName is DateTime datatype.
Otherwise if your Q is not related with the SQL select statement but rather how to measure difference between two dates you can use TimeSpan class for that purpose. Dim d1 As Date = CDate("2008-12-01") Dim d2 As Date = CDate("2008-12-11") Dim t As New TimeSpan t = d2.Subtract(d1) after that you can simply get any value you want: Response.Write(t.Days) Response.Write(t.Hours) etc.etc.
you are welcome but, which reply you found useful .. SQL SELECT statement or the one with using the TimeSpan class?