php - How to determine if date entered by the user is in future? -


How do I know in PHP that the date entered by the user from the current date?

i.e.

  if ($ current_date & lt; $ future_date) {// do all success actions here} other {// show the user that they Have a date selected in the past. }     

Well change the date string for the first time using the strtotime () function And then check whether the future date value exceeds the current date value.

Here is the code snippet:

  $ today_date = date ('Y-M-DH: I: S'); $ CURRENT_DATE = strtotime ($ today_date); $ Future_date = strtotime ($ future_date); // Received from user input  

Now you can call your function:

  if (current_date $$ lt; $ future_date) {// All success activities are here} and {// show the user that they have selected a date in the past. }  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -