Page 1 of 1

Date Problems

Posted: Sat Apr 22, 2006 6:48 am
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

Posted: Sat Apr 22, 2006 7:07 am
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)

Posted: Sat Apr 22, 2006 7:19 am
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