#native_company# #native_desc#

UK Tax Week Calculator

By David Shields
on January 30, 2003

Version: 0.1

Type: Function

Category: Calendars/Dates

License: Artistic License

Description: Function returns UK tak week accoring to Inland Revenue rules. Not exciting, but useful.

// PHP Function to calculate UK Inland Revenue tax week from passed date
// Parameters:
// $dd - day of month, 0-31
// $mm - month of year, 0-12
// $yy - Year (4 digits better!)
// I have not implemented error checking on parameters - its down to you to make sure params are correct!
// Warranties - NONE, (but its not rocket science!)
// Copyright: D B Shields, Broadowler Systems Ltd, 2003
// Contact: [email protected]
// Licence : Free to use, but dont sell it! 
function taxweek($dd, $mm, $yy){
	// Inland Revenue defined Week 1 as 6-12 April inclusive, Week 2 13-19 inclusive etc.
	// NB Day of week has NO bearing on week number - tax week may start on ANY day
	// first, stamp the supplied date
	// next, see where april first is for supplied year
	if ($apr6>$now){
		// we are in jan-apr, so apr1 needs to be prev year
	// now how many weeks have elapsed between w1start and now ?
	$wf=floor($w)+1; // not cel, as breaks boundaries
	return $wf;