gazever Posted February 13, 2007 Share Posted February 13, 2007 I am creating an avaliability calendar, however I am using a flat file database, as my client doesn't have SQL installed on his host. I have created some loops to show through 12 calendars for each house he has avaliable to rent. I get the current month by using the date as in code below and have a different txt file for each month which it loads then outputs a table calendar according to its state, booked, avaliable etc as a td css class. $start = date('m'); $start ++; $start --; However I increase it by one then decrease it by one to get rid of the prevailing zero, is there a better way to do this? Or can I keep the prevailing zero and increment 1 each time keeping it as it should be, 02, 03, 04 etc by using ++. Hope this makes sense. I haven't been using PHP for very long, Many Thanks Quote Link to comment https://forums.phpfreaks.com/topic/38306-solved-date-month-format/ Share on other sites More sharing options...
kenrbnsn Posted February 13, 2007 Share Posted February 13, 2007 If you don't want the leading zeros, use <?php $start = date('n'); ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/38306-solved-date-month-format/#findComment-183579 Share on other sites More sharing options...
paul2463 Posted February 13, 2007 Share Posted February 13, 2007 if you use <?php $start = date('n'); //note 'n' not 'm' $start ++; $start --; ?> the <a href="http://uk.php.net/date"> PHP Date Manual </a> is quite usefull edit: you beat me to it Ken - faster typer Quote Link to comment https://forums.phpfreaks.com/topic/38306-solved-date-month-format/#findComment-183581 Share on other sites More sharing options...
gazever Posted February 13, 2007 Author Share Posted February 13, 2007 Works a treat, thanks Quote Link to comment https://forums.phpfreaks.com/topic/38306-solved-date-month-format/#findComment-183585 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.