Ask a Question related to PHP Notes, Design and Development.
-
Php Net #1
note 33936 added to function.strtotime
Two usefull functions, if you want to built your own calendar.
################
# Returns date of the Monday for given number of week(1..53) and year.
# Output is in date-format.
function get_monday($week, $year=""){
$first_date = strtotime("1 january ".($year ? $year : date("Y")));
if(date("D", $first_date)=="Mon") {
$monday = $first_date;
} else {
$monday = strtotime("next Monday", $first_date)-604800;
}
$plus_week = "+".($week-1)." week";
return strtotime($plus_week, $monday);
}
###############
# analog to get_monday(), but returns Sunday:
function get_sunday($week, $year=""){
return get_monday($week, $year)+604799;
}
###############
# Example:
echo date("d.m.Y", get_monday(42, 2003)); // output is "13.10.2003"
----
Manual Page -- [url]http://www.php.net/manual/en/function.strtotime.php[/url]
Edit Note -- [url]http://master.php.net/manage/user-notes.php?action=edit+33936[/url]
Delete Note -- [url]http://master.php.net/manage/user-notes.php?action=delete+33936&report=yes[/url]
Reject Note -- [url]http://master.php.net/manage/user-notes.php?action=reject+33936&report=yes[/url]
Php Net Guest
-
note 33851 added to function.strtotime
If you need a numeric date in a specific format (e.g. 'yyyymmdd', 'yy:mm:dd',...) or some units of time interval before or after the current date... -
note 33827 added to function.function-exists
This can be used to conditionally define a user function. In this sense, it can act as a sort of inline include_once(). For example, suppose you... -
note 33727 added to function.is-int
To Logan: There's also a simple non-regexp way to convert a (form) value into an integer if it consists of numbers only - although with a trap... -
note 33714 added to function.register-tick-function
please can anyone help me to discover if this function can be used to make a chat ---- Manual Page --... -
note 33575 added to function.register-shutdown-function
If your script exceeds the maximum execution time, and terminates thusly: Fatal error: Maximum execution time of 20 seconds exceeded in - on line...



Reply With Quote

