php - Compare MySQL dates when stored as datetime -


i have tried several mysql queries compare column of dates stored datetime. need create several different queries depending on action taken on form. below example of sql have created:

create or replace view franchise_filter select * `c_data`.`franchise_leads`    `lead_added` between unix_timestamp(date_sub(now(),interval 3 months)) , unix_timestamp(now()) 

or

create or replace view franchise_filter select * `c_data`.`franchise_leads` `lead_added` <= 2012-06-27 00:00:00 

in second example date supplied php using:

date("y-m-d 00:00:00", strtotime($date_now, "+6 months")) 

any appreciated.

you close: use

... `lead_added` <= "2012-06-27 00:00:00" 

(mind quotes) and

... `lead_added` between date_sub(now(),interval 3 month) , now() 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -