You can use Date_Calc class
http://www.phpinsider.com/php/code/Date_Calc/
- Original Message -
From: "Don Read" <[EMAIL PROTECTED]>
To: "Matt "TrollBoy" Wiseman" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, June 29, 2001 1
How about this?
$today = getdate();
$week = (int) ($today["yday"] / 7);
Note: I'm not sure whether $today["yday"] begins with 0 or 1.
""Matt "TrollBoy" Wiseman"" <[EMAIL PROTECTED]> wrote in message
009801c10009$2a68c720$[EMAIL PROTECTED]">news:009801c10009$2a68c720$[EMAIL PROTECTED]...
> Does
On 28-Jun-01 Matt \"TrollBoy\" Wiseman wrote:
> Does know of anyway to get PHP to return the week number?
> As in there are 52 weeks in a year and this is week x?
don't bet on it.
> If there is no internal feature, perhaps something built into PHPLib?
date('z') / 7;
strftime('%U %V %W');
Re
From: "Brian Paulson" <[EMAIL PROTECTED]>
To: "'Matt "TrollBoy" Wiseman'" <[EMAIL PROTECTED]>
Sent: Friday, June 29, 2001 2:27 PM
Subject: RE: [PHP] Week Number
> When I needed this before I did dome thing like this
>
> // z day of th
I didn't see anything built in but you might try (date("z")/7) +1
Data Driven Design
P.O. Box 1084
Holly Hill, Florida 32125-1084
http://www.datadrivendesign.com
http://www.rossidesigns.net
- Original Message -
From: Matt "TrollBoy" Wiseman <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
here's a quick-n-dirty way.
$doy = date('z');
$week = (int)($doy / 7);
print $week+1;
but there's one thing to be wary of:
this counts full 7-day weeks, not calendar weeks,
so since the first week of a calendar year might
begin on wednesday or friday, this algorithm might
be a few days off if y
""Matt "TrollBoy" Wiseman"" <[EMAIL PROTECTED]> wrote:
> Does know of anyway to get PHP to return the week number?
> As in there are 52 weeks in a year and this is week x?
> If there is no internal feature, perhaps something built into PHPLib?
How about:
intval( date("z")/7 );
Luke Welling
---
7 matches
Mail list logo