Ask a Question related to PHP Development, Design and Development.
-
bad #1
year week
i´ve two variables the year and the week (2003 and 5) that means the 5th
week of the year 2003.
now i need the start- and enddate of the 5th week of year 2003.
i hope someone can help me to solve this problem.
bad Guest
-
How to get the year
I have a column in my MS SQL database called PurchaseDate and it has data like 12/20/2003, 1/24/2004 etc What I'm trying to do is: First to get... -
Dating into the next year
Using this tag DateFormat(CreateDate(YearPart, MonthPart, DayPart + 7), "mm/dd/yyyy")) with appropriate poung signs... I'm creating dates from... -
After more than a year nobody knows!!!!
Anybody out there who can and is willing to tell me how this web site was done. Or show me a way to create the same effect:... -
ASP.NET: Day / Work Week / Week / Month web calendar control with view like MS Outlook
Hi!! Did Infragistics or some other company else provide a web calendar conrol with the features and look of Microsoft Outlook calendar? I mean... -
Parsing a date from the week number of a given year from request post
I'm trying to get the date from a request-query post that contains a year (request("season") and a week number from that year... -
Richard Grove #2
Re: year week
"bad" <d.badstuebner@mervisoft.de> wrote in message
news:3FA65C0F.827D6813@mervisoft.de...> i´ve two variables the year and the week (2003 and 5) that means the 5th
> week of the year 2003.
> now i need the start- and enddate of the 5th week of year 2003.
>
> i hope someone can help me to solve this problem.
>
>
>
You don't need the year to work this out as it will be the same for every
year.
$weekstart=$week*7;
$weekend=$week*7+7;
for $a=1; $a<=365; $a++) {
if($a>1 AND $a<=31) $month="Jan";
if($a>31 AND $a<=59) $month="Feb";
etc. etc. until Dec.
if($a==$weekstart) $startdate="$a $month";
if($a==$weekend) $enddate="$a $month";
}
Untested of course, but should crudely do the trick.
Richard Grove
[url]http://shopbuilder.org[/url] - ecommerce systems
Become a Shop Builder re-seller:
[url]http://www.affiliatewindow.com/affiliates/merchantdetails.php?mid=611[/url]
[url]http://www.affiliatewindow.com/a.pl?590[/url]
Richard Grove Guest
-
Uffe Kousgaard #3
Re: year week
Richard Grove wrote:
The start- and enddate depends on the year, so your code won't work - no> "bad" <d.badstuebner@mervisoft.de> wrote in message
> news:3FA65C0F.827D6813@mervisoft.de...>>> i´ve two variables the year and the week (2003 and 5) that means the
>> 5th week of the year 2003.
>> now i need the start- and enddate of the 5th week of year 2003.
> You don't need the year to work this out as it will be the same for
> every year.
matter what it does.
Uffe Kousgaard Guest
-
Tom Thackrey #4
Re: year week
On 3-Nov-2003, bad <d.badstuebner@mervisoft.de> wrote:
$year = 2003;> i´ve two variables the year and the week (2003 and 5) that means the 5th
> week of the year 2003.
> now i need the start- and enddate of the 5th week of year 2003.
>
> i hope someone can help me to solve this problem.
$week = 4;
// this assumes that the first week of the year starts on a Sunday
$weekoffset = $week-1; // make week offset zero based
$soytime = strtotime("1/1/$year"); // get the timestamp for the 1st day of
the year
$soyoffset = date('w',$soytime); // get the number of days past sunday
$soydatetime = strtotime("-$soyoffset day",$soytime); // get the timestamp
for the sunday before or == to the start date of the year
$soweektime = strtotime("+$weekoffset week",$soydatetime); // get the
timestamp for the sunday of the week
$startOfWeek = date('m/d/Y',$soweektime); // convert the timestamp to a date
$endOfWeek = date('m/d/Y',strtotime("+1 week",$soweektime)); // add a week
and convert to a date
--
Tom Thackrey
[url]www.creative-light.com[/url]
tom (at) creative (dash) light (dot) com
do NOT send email to [email]jamesbutler@willglen.net[/email] (it's reserved for spammers)
Tom Thackrey Guest



Reply With Quote

