Get date from sql server datetime

I need to get a date with SQL Server datetime , and then format the date. (i.e. 01-Jan-2000 ) I am using PHP.

SQL is currently returning 2009-02-13 22:00:00.000 .

+4
source share
2 answers
 echo date('dM-Y', strtotime($datetime_from_db)); 
+12
source

You can combine the date in any format that you want to receive directly from mySQL query,

 SELECT DATE_FORMAT(column_name, '%d-%b-%Y') FROM tablename 
+1
source

Source: https://habr.com/ru/post/1338203/


All Articles