Symfony calculate number of days based on date

前端 未结 2 1153
一生所求
一生所求 2021-01-28 04:04

I am trying to calculate price for number of days from 1-21 based on date.

HomeController

$Sql = \' SELECT DISTINCT 
            a.property_id, a.date,         


        
相关标签:
2条回答
  • 2021-01-28 04:14

    I have solved this question based on the theory T. Abdelmalek gave me. I made an array and stored date and price of each date in and loped through. The answer has been deleted somehow I don't know how to mark as solved

    0 讨论(0)
  • 2021-01-28 04:24

    You can use date_diff like that:

    First date = $leave->getLeaveFrom();
    
        Second date = $leave->getLeaveTo();
        $diff = date_diff($leave->getLeaveFrom(),$leave->getLeaveTo());
    
    Results = var_dump($diff);
    
    0 讨论(0)
提交回复
热议问题