Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP Calendar/Date Question

Newbie
 
Join Date: Apr 2007
Posts: 5
#1: Nov 7 '07
Hello,

I'm working on a scheduling system for a class project with a small group of developers. It is my responsibility to write the start-up code for the week view of a calendar. I've written the php to correctly render the html that I want, but here is my problem:

At the top of each column will be the header that outputs the day of the week and the date. I'm looking for an efficient way to render the date dynamically for each header. The view will always have 7 days, (sunday at the left and saturday at the right).

We're running on top of a MySQL database. So I guess I'm wondering, would it be better to render the dates w/ a php function or should I use something from MySQL? I know MySQL has something like add_date(), sub_date() and you give it a specified interval, but like I said, I'm new to php so I don't know if there's a better way or not.

Anyway, just wondering if I could get some tips from someone who's implemented something similar? Thanks!

dafodil's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: Philippines
Posts: 393
#2: Nov 8 '07

re: PHP Calendar/Date Question


You can use whatever suits your need but if you're going to use php:

You can check a list of calendar functions here:
http://w3schools.com/php/php_ref_calendar.asp


Here are also a list of date functions:
http://w3schools.com/php/php_ref_date.asp

If the date is already stored in the database you can use mysql.
Newbie
 
Join Date: Apr 2007
Posts: 5
#3: Nov 9 '07

re: PHP Calendar/Date Question


Those were a huge help. Thanks!
dafodil's Avatar
Needs Regular Fix
 
Join Date: Jul 2007
Location: Philippines
Posts: 393
#4: Nov 9 '07

re: PHP Calendar/Date Question


Quote:

Originally Posted by korinth

Those were a huge help. Thanks!


No problem. I started from basics too.
:)
Reply


Similar PHP bytes