note 56679 deleted from function.mssql-query by cmb

From: Date: Sun, 23 Jun 2019 14:24:54 +0000
Subject: note 56679 deleted from function.mssql-query by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-211377@lists.php.net to get a copy of this message
Note Submitter: ---- To get column of type datetime as varchar in format: "YYYY-MM-DD" you should use: $query = "SELECT CAST(DATEPART(YYYY,row_date) AS CHAR(4)) + '-' + RIGHT(CAST(100+DATEPART(MM,row_date) AS CHAR(3)),2) + '-' + RIGHT(CAST(100+DATEPART(DD,row_date) AS CHAR(3)),2) + '' AS row_date, FROM TABLENAME WHERE id = '$id'"; (Where "row_date" is of type datetime)

« previous php.notes (#211377) next »