summaryrefslogtreecommitdiff
path: root/ext/date/lib/dow.c
diff options
context:
space:
mode:
authorDerick Rethans <derick@php.net>2008-07-14 17:36:12 +0000
committerDerick Rethans <derick@php.net>2008-07-14 17:36:12 +0000
commitc76ba173a91d9503c0912f3b546ca5aa9c45cb61 (patch)
tree7c82ae799d13613f7d11941ee68ae61a25bb7a14 /ext/date/lib/dow.c
parentbe5633612a0a6646b167bddeb15299dba726948a (diff)
downloadphp-git-c76ba173a91d9503c0912f3b546ca5aa9c45cb61.tar.gz
- MFH: Added a warning to the error struct in case a parsed-date was found to
be invalid.
Diffstat (limited to 'ext/date/lib/dow.c')
-rw-r--r--ext/date/lib/dow.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/date/lib/dow.c b/ext/date/lib/dow.c
index def1b3e59e..bd12d82fc7 100644
--- a/ext/date/lib/dow.c
+++ b/ext/date/lib/dow.c
@@ -140,6 +140,13 @@ timelib_sll timelib_daynr_from_weeknr(timelib_sll y, timelib_sll w, timelib_sll
return day + ((w - 1) * 7) + d;
}
+int timelib_valid_date(timelib_sll y, timelib_sll m, timelib_sll d)
+{
+ if (m < 1 || m > 12 || d < 1 || d > timelib_days_in_month(y, m)) {
+ return 0;
+ }
+ return 1;
+}
#if 0
int main(void)
{