diff options
author | Chuck Hagenbuch <chagenbu@php.net> | 2000-03-11 02:15:14 +0000 |
---|---|---|
committer | Chuck Hagenbuch <chagenbu@php.net> | 2000-03-11 02:15:14 +0000 |
commit | f42a770f65f83b89106ebc0a3f4b16bd3bc8e553 (patch) | |
tree | ce1beacabc7f291704b5efea925cd519c8194e89 /ext/mcal/php_mcal.c | |
parent | b460dcfa0aeaa686f29d27c4dd628cf2acd0edf3 (diff) | |
download | php-git-f42a770f65f83b89106ebc0a3f4b16bd3bc8e553.tar.gz |
Add mcal_week_of_year(), submitted by jtaskine@hit.fi.
Diffstat (limited to 'ext/mcal/php_mcal.c')
-rw-r--r-- | ext/mcal/php_mcal.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/mcal/php_mcal.c b/ext/mcal/php_mcal.c index d266e8ed50..e49bf7fb02 100644 --- a/ext/mcal/php_mcal.c +++ b/ext/mcal/php_mcal.c @@ -107,6 +107,7 @@ function_entry mcal_functions[] = { PHP_FE(mcal_time_valid,NULL) PHP_FE(mcal_day_of_week,NULL) PHP_FE(mcal_day_of_year,NULL) + PHP_FE(mcal_week_of_year,NULL) PHP_FE(mcal_date_compare,NULL) PHP_FE(mcal_event_init,NULL) PHP_FE(mcal_next_recurrence,NULL) @@ -1255,6 +1256,31 @@ PHP_FUNCTION(mcal_day_of_year) } /* }}} */ +/* {{{ proto int mcal_week_of_year(int year, int month, int day) + Returns the week number of the given date */ +PHP_FUNCTION(mcal_week_of_year) +{ + pval *year, *month, *day; + int myargc; + + myargc = ARG_COUNT(ht); + if (myargc != 3 || getParameters(ht,myargc,&year,&month,&day) == FAILURE) { + WRONG_PARAM_COUNT; + } + + convert_to_long(year); + convert_to_long(month); + convert_to_long(day); + + if (datevalid(year->value.lval,month->value.lval,day->value.lval)) { + RETURN_LONG(dt_weekofyear(day->value.lval,month->value.lval,year->value.lval)); + } + else { + RETURN_FALSE; + } +} +/* }}} */ + /* {{{ proto int mcal_day_of_week(int ayear, int amonth, int aday, int byear, int bmonth, int bday) Returns <0, 0, >0 if a<b, a==b, a>b respectively */ PHP_FUNCTION(mcal_date_compare) |