diff options
| author | Derick Rethans <derick@php.net> | 2007-07-12 18:59:05 +0000 |
|---|---|---|
| committer | Derick Rethans <derick@php.net> | 2007-07-12 18:59:05 +0000 |
| commit | 7588023b65fc08d7641b9f7e8ec6499bdddb048d (patch) | |
| tree | ae2e18331dad610fe04d440552e59b0fd8448e5a /ext | |
| parent | 4b64dbb9a19b962d9a4ec72dc128e5d48c425c9b (diff) | |
| download | php-git-7588023b65fc08d7641b9f7e8ec6499bdddb048d.tar.gz | |
- MFH: Missing file in previous commit.
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/date/php_date.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 52986630d8..b8be9e6b73 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -775,7 +775,7 @@ static char *date_format(char *format, int format_len, timelib_time *t, int loca /* year */ case 'L': length = slprintf(buffer, 32, "%d", timelib_is_leap((int) t->y)); break; case 'y': length = slprintf(buffer, 32, "%02d", (int) t->y % 100); break; - case 'Y': length = slprintf(buffer, 32, "%04d", (int) t->y); break; + case 'Y': length = slprintf(buffer, 32, "%s%04d", t->y < 0 ? "-" : "", abs((int) t->y)); break; /* time */ case 'a': length = slprintf(buffer, 32, "%s", t->h >= 12 ? "pm" : "am"); break; @@ -1740,7 +1740,7 @@ PHP_FUNCTION(date_parse) parsed_time = timelib_strtotime(date, date_len, &error, DATE_TIMEZONEDB); array_init(return_value); #define PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(name, elem) \ - if (parsed_time->elem == -1) { \ + if (parsed_time->elem == -99999) { \ add_assoc_bool(return_value, #name, 0); \ } else { \ add_assoc_long(return_value, #name, parsed_time->elem); \ @@ -1752,7 +1752,7 @@ PHP_FUNCTION(date_parse) PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(minute, i); PHP_DATE_PARSE_DATE_SET_TIME_ELEMENT(second, s); - if (parsed_time->f == -1) { + if (parsed_time->f == -99999) { add_assoc_bool(return_value, "fraction", 0); } else { add_assoc_double(return_value, "fraction", parsed_time->f); |
