General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 10th, 2003, 01:29 AM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 7
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Question Question with Getdate()

I have a form for updating an on-line calendar. On the form I am askign for the year of the event. What I would like to do is show the current year then the next three years in the drop down box. can I use the following code: (just echoing the year for the purpose of my question)
PHP Code:
 $today=getdate();
$year=$today['year'];
$loop=4;
while(
$loop>=1)
 {
   echo 
"$year";
   
$year++;
   
$loop--;
 { 


so it would show
2003
2004
2005
2006
__________________
CHornJr
"One day I'll know what I am doing"
My Blog
Suanhacky Lodge #49
Rebel Squadrons

Last edited by CHornJr : June 10th, 2003 at 01:31 AM.

Reply With Quote
  #2  
Old June 10th, 2003, 01:47 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
so what is the question?
__________________
-- Jason

Reply With Quote
  #3  
Old June 10th, 2003, 05:24 AM
digitallysmooth digitallysmooth is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Posts: 788 digitallysmooth User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 34 m 21 sec
Reputation Power: 7
I have just the code you need.
I created a class a while back that suited my needs perfectly.

There are areas that could use some functionality, but for the most part it works well.

http://www.laidbak.net/dateselect/
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #4  
Old June 10th, 2003, 08:10 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 7
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
Quote:
Originally posted by Taelo
so what is the question?


Will "year++" work

PHP Code:
 $today=getdate();
$year=$today['year']
$year++
echoe $year 

Reply With Quote
  #5  
Old June 10th, 2003, 08:14 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
CHornJr,

Have you given it a try... No better way of knowing than testing it out!

I think what Taelo was trying to say is that you may have answered your own question...
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #6  
Old June 10th, 2003, 08:20 PM
CHornJr's Avatar
CHornJr CHornJr is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Location: New York City
Posts: 236 CHornJr User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 1 h 50 m 36 sec
Reputation Power: 7
Send a message via AIM to CHornJr Send a message via MSN to CHornJr Send a message via Yahoo to CHornJr
It does work. What do oyu know. I guess I shoudl ahve tried it int he first palce. Well, now I know better. My next question won't be so stupid though

Reply With Quote
  #7  
Old June 10th, 2003, 08:26 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Quote:
Originally posted by CHornJr
It does work. What do oyu know. I guess I shoudl ahve tried it int he first palce. Well, now I know better. My next question won't be so stupid though


Hehehe... Don't feel so bad... We all make mistakes... but in the end, you solved your own!

Reply With Quote
  #8  
Old June 10th, 2003, 08:33 PM
ben rowe ben rowe is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 24 ben rowe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
they way I would do it would be like:

PHP Code:
 $year date("Y");

for(
$i $year$i < ($year 3); $i++) {

echo 
$year "<br>";




all this does is loop for the current year, + 3. also just as a developer note, for is alot faster then while

Reply With Quote
  #9  
Old June 10th, 2003, 08:39 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Quote:
Originally posted by ben rowe
they way I would do it would be like:

PHP Code:
 $year date("Y");

for(
$i $year$i < ($year 3); $i++) {

echo 
$year "<br>";




all this does is loop for the current year, + 3. also just as a developer note, for is alot faster then while


Hehehe... That's a lot easier... I'm with Ben on this one!! LOL

Reply With Quote
  #10  
Old June 10th, 2003, 08:57 PM
ben rowe ben rowe is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 24 ben rowe User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0

Reply With Quote
  #11  
Old June 10th, 2003, 10:06 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 366 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 30 m 59 sec
Reputation Power: 7
:P

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Question with Getdate()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT