Php SQL Server provides a small insight on time and date reading. Last Friday, I wanted to build a php program and connect the mysql database to the SQL Server database. I used to use mysql, but I was not very familiar with SQL Server. Nothing else. as of last Friday, we had to make a php connection to the mysql database and the SQL Server database at the same time.
I have been using mysql for a long time and I am not very familiar with sqlserver. None of them, at least mysql and sqlserver, are relatives.
When performing a conditional query. An error occurred.
First, the query time is in this format.
11 30 2009 10:20:20 AM
I open sqlserver database to view table data
It is 10:20:20. 233
Later, I checked it and it seems that sqlserver has a format problem, but the output was. there is no way. I can only convert it after querying the data.
In mysql
For example, if you want to query data in the period from
Select * from table where time> '2017-11-01 'and time <'2017-11-30 ';
I drew a tiger, but I don't know where I am going,
I think my is indeed not as good as 11 30 2009 10:20:20 AM or 10:20:20. 233, at least not comparable
So I switched my to 11 01 2009 00:00:00 AM and 00:00:00. 000
Another one is worse. An error occurs in. Isn't that uncomfortable!
So it's not easy to find me for a day. I can't influence my image because of this small problem. I woke up early today,
I found the convertime conversion function convert yesterday. There are many convert types, that is, I don't know whether I am stupid or I am stupid.
No way. you can only replace it. first, convert 2009-11-01 to 20091101, then convert 11 30 2009 10:20:20 AM or 2009-11-30 10:20:20. 233 to 20091130, and then compare,
Let alone, it's really a result.
Select * from table where convert (varchar (10), date_time, 112 )! <$ Begin_date and convert (varchar (10), date_time, 112)!> $ End_date
(! <And!> I almost caught up with me)
At the same time, I have been using mysql for the connection between the mysql database and the sqlserver Database. I am not very familiar with sqlserver, so I feel the stones crossing the river. Nothing else...