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
parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on line 5 Code: <?phpfunction shippingPrice($zone,$weight){ $ground = array(2 => array
WHYISNT THIS MYSQL STATEMNT NOT WORKING? (php)
caps because its absolutely rediculous.i dontunderstand why its not working. there is a column called id and a collumn called to then there is also. two rows with the field for `to` equal to the
values in array being escaped
I would like to submit some values - back to the same form for checking before processing...Code: [Select]<FORM method="post"><table width="500px"
Rand() help needed
Hi all,Can someone explain and give me a quick example of how I would go about this?I have 100 values in a database with colum headings of t_val and t_name. If I wanted to update all 100 of these
help with multi-update
Now sure how to ask this really....
The IE or FF detector
Hello Friends,Problem of today ( we seek for php help ) as following ,we know all that PNG images not shown well on IE6 and some "css'ers" given us a solution --> fine 1but if that
how to get IP address?
hey guys,i have this code which is supposed to get me the IP address of my site visitors:Code: <?php if ($_SERVER['HTTP_X_FORWARD_FOR']) {$ip = $_SERVER['HTTP_X_FORWARD_FOR'];} else {$ip =
Format timestamp from mysql
When I tried this:Code: date("m/d/Y H:i A", $row['timestamp'])I got 12/31/1969 18:33 PM, so I know the time section is working at least. How can I get the mm/dd/yyyy section to work
How to find OS bit version
How can I tell the person browsing my site is running 32, or 64 bit operating system?
Help with writing "$" with fopen
I just can't get my syntax correct. Could someone help me please? I am trying to write a connect file for inclusion as part of the installation routine for an app I am working on. I need this line to