Php formatting time. Php5.1.2 and MSSQL links. The time period is smalldatetime. The time shown in the library is: 21:23:00. 000 is displayed in PHP: 2007 & nbsp; April & nbsp; 6 & nbsp;. how can I get a time format like? ------ Solve the php formatting time problem.
Php5.1.2 and MSSQL links.
The time period is smalldatetime.
The time shown in the library is: 21:23:00. 000
It is displayed in PHP: 2007 21:23, January 1, April 6
How can I get a time format like?
------ Solution --------------------
Date ('Y-m-D', strtotime ($ row ['somedate']);
------ Solution --------------------
$ S = "2007-04-06 21:23:00. 000 ";
$ T = explode ("", $ s );
Echo $ t [0];
------ Solution --------------------
$ S = "somedate ";
$ T = explode ("", $ s );
Switch ($ t [1])
Case "January ":
$ Month = "01 ";
Break;
Case "February ":
$ Month = "02 ";
Break;
Case "March ":
$ Month = "03 ";
Break;
Case "April ":
$ Month = "04 ";
Break;
Case "May ":
$ Month = "05 ";
Break;
Case "June ":
$ Month = "06 ";
Break;
Case "July ":
$ Month = "07 ";
Break;
Case "August ":
$ Month = "01 ";
Break;
Case "September ":
$ Month = "09 ";
Break;
Case "October ":
$ Month = 10;
Break;
Case "November ":
$ Month = 11;
Break;
Case "December ":
$ Month = 12;
Break;
}
Echo $ t [0]. "-". $ month. "-". $ t [2];
I am not sure whether the above two methods are correct.
------ Solution --------------------
This is an MSSQL problem. it will call the system time display format.
You can convert strtotime to UNIX timestamp, and then use the date function