jeeva Posted January 20, 2007 Share Posted January 20, 2007 hi Frnds,how can i get date difference between two dates for example if i have selected 29-12-2006 and 05-01-2007 then i want display the dates like 30-12-2007,31-12-2007,01-01-2007,02-01-2007,03-01-2007 and 04-01-2007.thanks in advancejeeva.. Quote Link to comment Share on other sites More sharing options...
paul2463 Posted January 20, 2007 Share Posted January 20, 2007 try this[code]<?php$start = "20-2-2007";$end = "3-3-2007";$st = explode("-",$start);$newStart = strtotime("$st[2]-$st[1]-$st[0]"); //rearange date so it is Y-m-d/coverts to timestamp$fi = explode("-",$end);$newEnd = strtotime("$fi[2]-$fi[1]-$fi[0]");do{ echo date("d-m-Y",$newStart); echo ", "; $newStart = strtotime("+1 day", $newStart); }while ($newStart < $newEnd)?>[/code]it prints out all the dates from the start date to the end date Quote Link to comment Share on other sites More sharing options...
jeeva Posted January 20, 2007 Author Share Posted January 20, 2007 thanks a lot...it saved me Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.