JJohnsenDK Posted December 19, 2007 Share Posted December 19, 2007 Hey Is there a function to find the first day in the month. You know the first day in december was saturday, how do i get this? Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/ Share on other sites More sharing options...
corbin Posted December 19, 2007 Share Posted December 19, 2007 $tmp = strtotime('December 1'); echo date('l', $tmp); There might be a math way to do it, which would be faster, but that would work. Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418834 Share on other sites More sharing options...
kenrbnsn Posted December 19, 2007 Share Posted December 19, 2007 You can use the functions strtotime() and date() <?php echo 'The first day of December, 2007 is a ' . date('l',strtotime('12/1/2007')); // thats a small L not a 1 ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418836 Share on other sites More sharing options...
JJohnsenDK Posted December 19, 2007 Author Share Posted December 19, 2007 i need to get the number because i need to make blank boxes at the start of the calendar. You know if the 1. of a month is wedensday then the first to boxes (monday and Thusday) cant hold any numbers of that month. watch here for example: http://www.jjwebsites.dk/test/calender/index3.php?page=1 Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418851 Share on other sites More sharing options...
kenrbnsn Posted December 19, 2007 Share Posted December 19, 2007 Then you want to use the "w" specifier to the date() function. Read the manual pages I referenced. Ken Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418857 Share on other sites More sharing options...
JJohnsenDK Posted December 19, 2007 Author Share Posted December 19, 2007 found it on php.net... sry for asking... and thanks for helping it out Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418862 Share on other sites More sharing options...
revraz Posted December 19, 2007 Share Posted December 19, 2007 http://php.about.com/od/finishedphp1/ss/php_calendar.htm Quote Link to comment https://forums.phpfreaks.com/topic/82390-solved-making-calendar-how-do-find-the-first-day-in-the-month/#findComment-418899 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.