Date of exit from the database, must be formatted as "mm / dd / yy"
For Each dr as DataRow in ds.Tables(0).Rows Response.Write(dr("CreateDate")) Next
string.Format( "{0:MM/dd/yy}", dr("CreateDate") )
Edit: If dr ("CreateDate") is DBNull, this returns "".
Convert.ToDateTime (dg ("CreateDate")). ToShortDate ()
See MSDN docs for other functions available from the DateTime data type, including custom formats available through the ToString function.
Response.Write(DateTime.Parse(dr("CreateDate").ToString()).ToString("MM/dd/yyyy"))
:
((DateTime)dr["CreateDate"]).ToString("MM/dd/yyyy")
// , dbnull, ,
if (! DBNull.Value.Equals(dr["CreateDate"])) // blah blah
Source: https://habr.com/ru/post/1697474/More articles:How to use win32api from IronPython - c #ASP.Net Server Management Procedure - eventsNested SELECT statement - sqlBest way to read query string parameters safely? - javascriptWhat do you call asynchronous web request in VB.NET? - vb.netIncluding many rewrite directives in lighttpd - lighttpdTypical Star-schem Kimball datastore - are model options possible? and how to generate code - sqlHow can I get Ruby SOAP :: RPC :: Driver to work with self-signed certificates? - soapRunning CRUD in Turbogears - pythonPerl or Python script to remove a user from a group - pythonAll Articles