Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 31st, 2006, 02:10 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 249
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dates Skips Over Month

Can somebody please tell me why my problem is occurring. I have worked trying different things all morning and cannot figure it out. The problem is that I need to go from month to month. It works good til the end of the month and now in January it is skipping over the month of February. A sample can be seen at

if (!isset($_GET['cal'])) {
$iCalTracker = 0;
} else {
$iCalTracker = $_GET['cal'];

$iLastMonth = $iCalTracker - 1;
$inextMonth = $iCalTracker + 1;

$curMonth = strftime ("%d/%m/%Y", strtotime($iCalTracker . " month"));
echo $curMonth . " curr month<BR>";
------Results-- 31/01/2006 curr month

$exploded_date = explode('/', $curMonth);

$curViewMonth = date("F", mktime(0, 0, 0, $exploded_date[1], $exploded_date[0], $exploded_date[2]));
echo $curViewMonth;

if ($iCalTracker > 0 && empty($_GET['view'])) {
$lastViewMonth = date("F", mktime(0, 0, 0, $exploded_date[1]-1, $exploded_date[0], $exploded_date[2]));
echo "<a href='calendar.php?cal=" . $iLastMonth . "'>&lt;&lt; " . $lastViewMonth . "</a>";

-------This is where it jumps over February and go straight to March
if(empty($_GET['view'])) {
$nextViewMonth = date("F", mktime(0, 0, 0, $exploded_date[1]+1, $exploded_date[0], $exploded_date[2]));
echo "<a href='calendar.php?cal=" . $inextMonth . "'>" . $nextViewMonth . " &gt;&gt;</a>";


Thanks In Advance

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting month name to month number kalyanykk SQL Server 2005 7 August 19th, 2008 10:37 PM
cin.getLine() function skips. Please help! unpopular C++ Programming 3 February 29th, 2008 11:50 AM
How to print dates of month in DROP DOWN doosti Classic ASP Basics 5 October 2nd, 2006 09:32 AM
How to print dates of month in DROP DOWN doosti Classic ASP Professional 3 October 2nd, 2006 09:30 AM
query Current Month, Month+1, Month+2, Month+3 anterior Access 2 September 24th, 2006 08:25 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.