help regarding dates

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
greedyisg00d
Forum Commoner
Posts: 42
Joined: Thu Feb 12, 2009 2:48 am

help regarding dates

Post by greedyisg00d »

Hi I am just new to php I am currently developing an scheduler for meetings,conference etc. I have a $date_from and $date_to variable in my code which is stored in my database.

For example:
Date From:04-Feb-2009
Date To: 08-Feb-2009

My problem is I do not know the logic on how can I retrieve the dates in between (Feb, 5,6,7) and store it in the database. Any idea how it works? Thanks
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: help regarding dates

Post by susrisha »

Code: Select all

 
$date_from = '04-Feb-2009';
$date_to = '08-Feb-2009';
 
$date = strtotime(date("d-M-Y", strtotime($date_from)) . " +1 day");
echo date("d-M-Y",$date);
 
check out this code..
$date will have the next day..
Post Reply