In Cakephp, To translate the application language into another, we use internationalization and localization. To display the correct translated date string on change of locale, we need to use right classes.
use Cake\I18n\I18n; use Cake\I18n\Time; I18n::Locale('es’'); // es locale is for Spanish $date = ‘2017-08-29 23:00:00’; $createdDate = $date->i18nFormat('MMM d, YYY'); echo $createdDate; // Displays ago. 29, 2017 in spanish // By default Spanish month displays in lowercase
If we use Default Locale i.e. English then $createdDate displays – Aug 29, 2017
Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.