Date Subtraction

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
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Date Subtraction

Post by guitarlvr »

I'm trying to subtract two month and days to get how many days they are apart. the following code displays 0. Could someone please point me in the right direction?

Code: Select all

<?php
$today = date('m-d');
$bday = '06-15';
$diff = ($bday - $today) / 86400;
echo $diff;
?>
Thanks in advance!

Wayne
User avatar
guitarlvr
Forum Contributor
Posts: 245
Joined: Wed Mar 21, 2007 10:35 pm

Post by guitarlvr »

Never mind, I'm going a different direction. Thanks.

Wayne
Post Reply