php - compare dates not working -


Hello,

I'm comparing 2 dates. It is clear that $ db_minus7 is bigger then The value of $ can_invoiced may be 'may be' but this is 'yes'. When I execute.

  & lt ;? Php $ db_minus7 = '2010-07-05 09: 45: 29.420'; $ Completion_data = '30 .07.2009 '; If (date ("m-d-y", strotom ($ db_minus7)) date ("m-d-y", strotom ($ completion_data))) {$ can_invoiced = 'maybe'; } And {$ can_invoiced = 'yes'; } Echo $ can_invoiced; ? & Gt;  

Please help

Why do not you simply compare Creating them in this way:

  if (strotom ($ db_minus7)> strotom ($ completion_data)) {$ can_invoiced = 'maybe'; } And {$ can_invoiced = 'yes'; }  

Edit:

If you want to use the date (), "Ymd" Or "YMD" as the pattern because it is a comparison of the string, and it is a logical command to work ("big" (year) to small (day .. Or maybe seconds, if you need));


Comments