hi,
i found this snippet on php.net
QuoteFor the week number for weeks starting on Sunday:
<?php
function week_of_year($month, $day, $year) {
$day_of_year = date('z', mktime(0, 0, 0, $month, $day, $year));
/* Days in the week before Jan 1. If you want weeks to start on Monday make this (x + 6) % 7 */
$days_before_year = date('w', mktime(0, 0, 0, 1, 1, $year));
$days_left_in_week = 7 - date('w', mktime(0, 0, 0, $month, $day, $year));
/* find the number of weeks by adding the days in the week before the start of the year, days up to $day, and the days left in this week, then divide by 7 */
return ($days_before_year + $day_of_year + $days_left_in_week) / 7;
}
?>
so if i go : week_of_year(1, 3, 2010) (sunday)
the week shows as 1, because the script is set to begin new week on sunday,
however i am confused by his instruction " (x + 6) % 7 " to have the week start on a monday
what part of the script do i apply this equation ???
thanks
Get word number x from string?
How can I use a function to loop through a string, and "have a look at" every word in the string, probably separated by a comma, and print them out, like this:word 1: xxxxword 2: xxxxword 3:
Only add new information from XML to MySQL
What I am doing, is taking a xml file, and adding the values to a database. However, what I want to do is only add the new values.I am guessing that a script that compared the first xx chars of the
Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem:
gather checkbox data from form into email
Hello all,First, i'd like to thank everyone who responded to my previous posts regarding setting up an SMTP server for my php form. I ended up figuring it out and my form is up and functioning,
values not being entered into table
hi. I;ve created a form, so that when a user enters data into it, it gets added to a table in a database. the form submits some data to one table, and other data to another table. my problem is that
cyrillic string conversion question
Hello,
simplexml and xpath - Need some help
Hello,I am trying to parse an xml which comes back from Amazon and I am trying to know how many Browsenodes are shown within the XML.I am using the classs Tarzan to get the xml from Amazon and the
Session
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not have any trouble logging into forums such at these, so not sure why this is not working.first the
want a code for uploading and downloading
i m trying to upload and download to my site..i need upload and download code ...i use a code for upload but that is not working actually..i don't know what is the problem.when i upload a file and
login from external site
Hi my new experience begins, Now what i am trying to do is i make three pages, login.php logout.php index.php . Now if i will not give correct detail i can not see the index.php ,all working perfect