CFormatter::formatDate and formatDateTime should also accept strings in strtotime() format #291

qiangxue opened this Issue Feb 15, 2012 · 0 comments


None yet

2 participants


It's very common to use DATE and DATETIME fields in MySQL. CFormatter's date methods don't accept these. This is inconvenient, because several components use this formatter. For example when you want to create a CGridView like:


it will throw an error, because the underlying CFormatter always expects a UNIX timestamp.

It should implement the same logic as in CDateFormatter::format() where the type of the supplied value is tested before:

$value=ctype_digit($value) ? (int)$value : strtotime($value);

Migrated from

@francistm francistm referenced this issue Aug 8, 2012

fix ehn #291 #1172

@cebe cebe added a commit that closed this issue Sep 3, 2012
@cebe cebe fixes #291 CFormatter dates can now be strtotime values
makes #1172 obsolete
@cebe cebe closed this in cdefc64 Sep 3, 2012
@cebe cebe was assigned Sep 3, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment