Date Problems

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
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Date Problems

Post by Ruski »

Hi,
Im currently doing a project for college and I am a bit stuff with the dates in my project.
This is basically what Im trying to do:

Code: Select all

User enters date in the future
Script calculates days till that day (done)
Scipt gets week number on the year on that date
Script gets week day number or name, such as Monday or 1

If anyone has any suggestions on how I would go about doing that, please help out.
All suggestions welcome

Thanks in Advance
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

I suggest that you start reading at http://www.php.net/date... And let us know what you've come up with.. (mktime, strtotime can come in handy too)
Ruski
Forum Commoner
Posts: 28
Joined: Thu May 26, 2005 3:45 am

Post by Ruski »

Well... Just proves that im lazy on reading up things, ive came up with solutions for both of my questions

Week number:

Code: Select all

alert( date("W", mktime(0, 0, 0, 05, 23, 2006)) );
Week day:

Code: Select all

alert( date("w", mktime(0, 0, 0, 05, 23, 2006)) );
Thanks for poiting me in the right direction
Post Reply