[solved] Date Problem

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
waqas_punjabian
Forum Commoner
Posts: 67
Joined: Wed Aug 10, 2005 9:53 am

[solved] Date Problem

Post by waqas_punjabian »

hi,

Problem:

How can i get dates of every week starting from saturday

Ther would be 2 pull down menus. 1) for years 2) for week dates starting from saturday.

I need the ability to change this menu, for example for 2007. 2008, etc.

june 5th
june 12th
june 19th
june 26th

July 3
July 10th
July 17th
July 24, etc

-------------------------------------------------------------------------------------

Kindly, help me how can i do that or, can i get the code for that, or how can i start working on that ?
Thanks in Advance.
Last edited by waqas_punjabian on Fri Sep 23, 2005 10:59 am, edited 2 times in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

strtotime() is probably the fastest way to get 1 correct date. If you get the first saturday of a year, you can add 7 days to it until it wraps around to a new year.....

Code: Select all

[feyd@home]>php -r "echo(date('Y-m-d D',strtotime('this saturday',mktime(0,0,0,1,1,2005))));"
2005-01-01 Sat
[feyd@home]>php -r "echo(date('Y-m-d D',strtotime('this saturday',mktime(0,0,0,1,1,2004))));"
2004-01-03 Sat
waqas_punjabian
Forum Commoner
Posts: 67
Joined: Wed Aug 10, 2005 9:53 am

Post by waqas_punjabian »

hey

thanks buddy,

it 've been solved

regards

WAQAS
Post Reply