Skip to content

Here is the code and issue with calculation using your functions #45

@akathuria2015

Description

@akathuria2015
          Here is the code and issue with calculation using your functions

Below is the code to add the year month day to Ethiopian date of 07/03/2016 in the format of dd/mm/yyyy
$et = '07/03/2016'; // Ethiopic date string in dd/mm/yyyy format
[$day, $month, $year] = explode('/', $et); // split it by the delimiter

    $date = Andegna\DateTimeFactory::of($year, $month, $day);

    $sentencedate =$date->add(new \DateInterval('P1Y3M15D'));

    //$sentencedate = $date->modify('+15 days +3 months +1 year');

    //$sentencedate = $sentencedate->modify('-1 day');
    dd($sentencedate); 

output of this code is 25/06/2017 which is wrong as it does not take into account the Ethiopian months are 30 days for 12 months and the 13th month is 5 or 6 days depending on the leap year. if you take this into account the correct 17/06/2017. how can I solve this using PHP. This date of 07/03/2016 can be any date entered by the user in Ethiopian format

Originally posted by @akathuria2015 in #44 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions