SQL datetime to string format
问题 I have some code which declares an object variable, and this variable is assigned a value from an existing database field. Dim datestart As Object datestart = dbToDate(dr("DateStart")) The variable is then passed through a function which checks whether or not it is null, and then converts it into datetime data type. Public Shared Function dbToDate(o As Object) As DateTime If o Is DBNull.Value Then Return Nothing Else Return Convert.ToDateTime(o) End If End Function The last thing I need to do