Date Difference - Php

Date Difference

Snippet Code


  
Rate this page :
  [ 0 votes]

This code used to find difference between two date

<?php function dateDiff($dformat, $endDate, $beginDate) { $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[1], $date_parts1[2], $date_parts1[0]); $end_date=gregoriantojd($date_parts2[1], $date_parts2[2], $date_parts2[0]); return $end_date - $start_date; } $curdate=date('Y-m-d'); $predate="2009-12-16"; echo dateDiff("-", $curdate, $predate); ?>

Tags


Ask Questions

Ask Question