PHP Web Host - Quality Web Hosting For All PHP Applications $35/month $250/year (Unlimited) - $25/month - 200,000 impressions - Your Ad Could be Here - Click For Details
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Thu Jan 10, 2008 3:59 pm Reply with quote Back to top

I am working on a Weekly Calendar for a project and there has to be a better way.

Pease don't write the code....just point me in the right direction....

Code:
   $year = $today[year];
   $month = $today[mon];
   $day = $today[mday];

   

$tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
echo date("Y/m/d", $tomorrow);
echo "<br>";
$tomorrow2 = mktime(0,0,0,date("m"),date("d")+2,date("Y"));
echo date("Y/m/d", $tomorrow2);
echo "<br>";
$tomorrow3 = mktime(0,0,0,date("m"),date("d")+3,date("Y"));
echo date("Y/m/d", $tomorrow3);
echo "<br>";
$tomorrow4 = mktime(0,0,0,date("m"),date("d")+4,date("Y"));
echo date("Y/m/d", $tomorrow4);
echo "<br>";
$tomorrow5 = mktime(0,0,0,date("m"),date("d")+5,date("Y"));
echo date("Y/m/d", $tomorrow5);
echo "<br>";
$tomorrow6 = mktime(0,0,0,date("m"),date("d")+6,date("Y"));
echo date("Y/m/d", $tomorrow6);
echo "<br>";


This is what I have and it works. What I would really like is an array holding mdY so I can loop through the rest of the code with it.

My bet is that it is real simple and I am having a old age moment.

Dave
View user's profile Send private message
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Thu Jan 10, 2008 4:39 pm Reply with quote Back to top

Only registered users can see links on this board!
Get registered or login to the forums!
is very useful for these types of things.

There is a lot of date related code you could look at in GCalendar. Smile Check out the viewweek.php file (I think that is what it is called). That file does GCalendar's weekly view.
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Thu Jan 10, 2008 7:16 pm Reply with quote Back to top

Dawg wrote:

Please don't write the code....just point me in the right direction....
Only registered users can see links on this board!
Get registered or login to the forums!
Only registered users can see links on this board!
Get registered or login to the forums!
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Thu Jan 10, 2008 7:21 pm Reply with quote Back to top

This page was my friend when I first started working on GCalendar:
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Fri Jan 11, 2008 5:46 am Reply with quote Back to top

Thanks guys. I was already on those like stink. The reak issue is being able to take a users input date and then add 7 days to it.

Take 1-28-08 for example. The function has to be aware that Jan has 31 days and go from 1-31-08 to 2-1-08. I have a loop of really cool stuff to roll through if I can ever get this right.

Dawg
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Jan 11, 2008 6:42 am Reply with quote Back to top

Exactly what the Doctor ordered Wink
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Gremmie
Former Moderator in Good Standing


Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Fri Jan 11, 2008 8:19 am Reply with quote Back to top

Yup, like I said, strtotime is really useful for those types of things. It can parse things like "1-28-08 +7 days".
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Fri Jan 11, 2008 9:58 am Reply with quote Back to top

Embarassed I never saw that post - sorry!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Sun Jan 13, 2008 9:08 am Reply with quote Back to top

I have the array and I have it working....but I can not seem to change the date.

I am bringing in varibles from user input...

Code:

echo $month;
echo $day;
echo $year;
$dates_array = array();
for ($i=0; $i<7; $i++) {
  $dates_array[] = date('M-d-Y', strtotime("+$i days"));
}
echo "<br>";
echo $dates_array[1];
echo "<br>";
echo $dates_array[2];
echo "<br>";
echo $dates_array[3];
echo "<br>";
echo $dates_array[4];
echo "<br>";
echo $dates_array[5];
echo "<br>";
echo $dates_array[6];
echo "<br>";


I have tried a 1000 versions of
Code:
$dates_array = array();
for ($i=0; $i<7; $i++) {
  $dates_array[] = date('M-d-Y', strtotime("+$i days"));
}


but I can not get it to except the date input by the users. Guys can you give me a hint....this thing is driving me nuts!

Dawg
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Jan 13, 2008 9:26 am Reply with quote Back to top

In your <form> are you using GET or POST?

Whichever, your PHP script has to pull those values in from the $_GET or $_POST array.

Example:
$month = $_GET['month']
or
$month = $_POST['month']
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Sun Jan 13, 2008 9:42 am Reply with quote Back to top

LOL....That was just where I was echoing out the vars to make sure they were coming through correctly....

This is were I am setting them...

Code:
   $year = (int)$_POST['pyear'];
   $month = (int)$_POST['pmonth'];
   $day = (int)$_POST['pday'];




What I need help with is how to reset the date in the datas array to the year, month and day as set by the user.

Thanks for the help.
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Sun Jan 13, 2008 3:57 pm Reply with quote Back to top

You set $year, $month, and $day... but no where do you use these values to insert into $dates_array
View user's profile Send private message Visit poster's website
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Sun Jan 13, 2008 4:14 pm Reply with quote Back to top

Evaders,
I have tried about 500 differnt ways but none of them work. So I am asking ya'll
How do I use these values in the $dates_array ?

I looked and looked and looked for an example somewhere but could not find one. I got the array to work..... Smile

Dawg
View user's profile Send private message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

PostPosted: Sun Jan 13, 2008 4:39 pm Reply with quote Back to top

Try something like this.

$dates_array = array();
for ($i=0; $i<7; $i++) {
$inDate = "$month-$day-$year";
$inDate = strtotime($inDate);
$inDate = strtotime("+$i days", $inDate);
$dates_array[] = date('M-d-Y', $inDate);
}
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Dawg
RavenNuke(tm) Development Team


Joined: Nov 07, 2003
Posts: 889

PostPosted: Mon Jan 14, 2008 8:05 am Reply with quote Back to top

Raven,
Thank You! I would have NEVER figured that out!! With your help there I got it!! WOOT WOOT!

I had to change a couple of the formats on the dates adn then explode the vars out and loop through me and bingo...bango it worked.

Thank You to everyone for your help!

Dawg
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum