Good morning guys, I'm having a question about date manipulation. I need to get a value (given by the user) and turn this value into day of the month.
Example:
$Valor_Usuario = 30;
$Data = 12/10/2018;
$Resultado = 30/10/2018;
What I'm trying to do is, a spending routine, so the user informs me a fixed day of spending, (Every day 30 I'll spend $ 50) and the system every 30 days will subtract $ 50 from the account. What gives me another doubt ...
After manipulating the date how do this checking the date? (If today is day 30 or not // To know when to subtract the $ 50)
RESOLVED
Date manipulation:
$data = explode("-",date('d-m-Y')); //coloquei a data em array
$data[0] = 31; //mudei "manualmente" o array do dia ($data[0])
$nova = implode("-", $data); //juntei os arrays novamente
NA TELA = 31-12-2018
$check = date("t", strtotime('m-Y')); //Peguei o dia max do mes Ex:28,29...
$conv = $data[0] < $check ? $data[0]:$check; //Se a DT do usuario for < DT do mes = DT do usuario SENAO DT do mes
Task Scheduling
- I used the TaskScheduler of windows. Home
- I asked the Task to open PHP.exe every day. // have to open php.exe because only the task will open the page and in my case I wanted to run the script
- And as a parameter open the directory of my script (c: xampp \ htdocs \ test \ test.php).