Compare two dates in the string format - Php

Compare two dates

Snippet Code


  
Rate this page :
  [ 0 votes]

Convert the strings in to the time format using strtotime function and compare.

$date1 = strtotime($date1); $edit_date = strtotime($date2); if ($edit_date < $storedDate) { //some action } else { //some action }

Tags


Ask Questions

Ask Question