?
Solved

PHP list past months ??

Posted on 2007-03-23
4
Medium Priority
?
521 Views
Last Modified: 2008-03-25
I'm trying to put together a quick blog together and want to display a list of months, say, around 20 with years past beginning from current year ie...

March 2007
Feb 2007
Jan 2007
Dec 2006     etc....

Can someone show me a function that'll do this? If the listing could have links such as the following....

March 2007  - index.php?m=3&y=2007

Thanks!!
0
Comment
Question by:kornflake
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 5

Accepted Solution

by:
Oscurochu earned 100 total points
ID: 18780110
check this out, im pretty sure it will help you

http://www.php.net/manual/en/ref.calendar.php
0
 
LVL 3

Assisted Solution

by:ERNesbitt
ERNesbitt earned 100 total points
ID: 18781919
I use: mktime( Hour, Min, Sec, Month, Day, Year ) to store my time stamps, that way I can inject variables for months and years.

$dtmBegin=mktime(0,0,0,$strBegMonth,1,$strBegYear);
$dtmEnd=mktime(0,0,0,$strEndMonth+1,0,$strEndYear);
/* The zero day for the next month is the last day of the previous month. e.g. mktime(0,0,0,3,0,2000); would give you the date stamp for Feb 29,2000 */

Then to search for dates I just search for everything between my start and end dates.  You can probably create a nested loop from there to loop through the years and then loop the months inside of that.
0
 
LVL 1

Expert Comment

by:Computer101
ID: 21207276
Forced accept.

Computer101
EE Admin
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question