Need help for calculating days between 2 dates

Discussion in 'PHP' started by ksamir2004, Apr 14, 2008.

  1. #1
    Hi All,

    How to calculate days between two dates.. i am using oracle 10g + PHP..
    if days is less then 20 our program will send mailt to respective team..

    i need your help...

    Thanks
    Sam
     
    ksamir2004, Apr 14, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    sam it has nothing to with oracle its a simple php problem

    function dateDiff($dformat, $endDate, $beginDate)
    {
    $date_parts1=explode($dformat, $beginDate);
    $date_parts2=explode($dformat, $endDate);
    $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
    $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
    return $end_date - $start_date;
    }

    $date1="07/11/2003";
    $date2="09/04/2004";

    $dd=dateDiff("/", $date2, $date1);

    if ($dd<20)
    mail....



    Regards

    Alex
     
    kmap, Apr 14, 2008 IP
  3. ksamir2004

    ksamir2004 Peon

    Messages:
    70
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks Alex, but i want to take both date from Oracle 10g database table... let me know how to pass date1, date2 in function...

    Regards,
    Sam
     
    ksamir2004, Apr 14, 2008 IP