Skip to content


Subversion checkout URL

You can clone with
Download ZIP


add `y` pattern to CDateTimeParser #2119

wants to merge 1 commit into from

4 participants


This PR resolves the issue of parsing strings ending with a 4-digits-year when "short" format is set to dd/MM/y.

See #1436


Any news on this?


Not sure the fix is so obvious. In #1436 there is URL:

Pedberg said:

This is fixed for CLDR 23. Note that a single 'y' will still parse a 4-digit year (or a 3-digit or 5-digit year...), in addition to formatting using as many digits as necessary with zero-padding.

I'm confused with the following part: a 4-digit year (or a 3-digit or 5-digit year...). This is not what you have in your patch.


What is a 3-digit or 5-digit year? Do we really go that far into future/past?


Postponed to 1.1.15.

@cebe cebe closed this pull request from a commit
@mrpelle mrpelle add `y` pattern to CDateTimeParser
close #2119
@cebe cebe closed this in 6e4a51a

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 15, 2013
  1. @mrpelle
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 0 deletions.
  1. +2 −0  framework/utils/CDateTimeParser.php
2  framework/utils/CDateTimeParser.php
@@ -23,6 +23,7 @@
* MM | Month digit 01 to 12, zero leading
* MMM | Abbreviation representation of month (available since 1.1.11; locale aware since 1.1.13)
* MMMM | Full name representation (available since 1.1.13; locale aware)
+ * y | 4 year digit, e.g., 2005 (available since 1.1.14)
* yy | 2 year digit, e.g., 96, 05
* yyyy | 4 year digit, e.g., 2005
* h | Hour in 0 to 23, no padding
@@ -90,6 +91,7 @@ public static function parse($value,$pattern='MM/dd/yyyy',$defaults=array())
case 'yyyy':
+ case 'y':
return false;
Something went wrong with that request. Please try again.