3 month 1 day spreadsheet where to start

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
jonnyfortis
Forum Contributor
Posts: 462
Joined: Tue Jan 10, 2012 6:05 am

3 month 1 day spreadsheet where to start

Post by jonnyfortis »

i am building a student register for classes that only happen once a week and are paid for quarterly.
i want to show across the top of the spreadsheet the date of the class for three months for example

march / april / may 2016

1/3/16 | 8/3/16 | 15/3/16 | 22/3/16 | 29/3/16 | 5/4/16 | 12/4/16 etc....
--------------------------------------------------------------------------------
then in this section here there will be a tickbox to show if student has turned up

i want this to continue every three months

i have know idea where to start
thanks
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: 3 month 1 day spreadsheet where to start

Post by Christopher »

The place to start is learning how to use the DateTime classes in PHP:

http://php.net/manual/en/book.datetime.php (there are also tutorials out there if you search for them)

And for your problem, learning how to get specific dates like the next Tuesday:

http://php.net/manual/en/datetime.formats.relative.php (likewise, examples out there if you search for them)

Once you learn the basics of using DateTime then DateInterval and DatePeriod will get you the rest of the way on your project.

PS - the DateTime classes may seem complex, the they are so much better than doing it all manually.
(#10850)
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: 3 month 1 day spreadsheet where to start

Post by Celauran »

Once you have a good understanding of DateTime, take a look at Carbon. It gives DateTime a friendlier API.
Post Reply