📜 ⬆️ ⬇️

timeAgoInWords in Russian

Hi, bakers.
Do you want dates in your project to be written like this: “1 day, 3 hours ago”
or so: "2 months, 2 weeks, 3 days ago"?



Download the file from here and put it in “cakedir \ app \ locale \ rus \ LC_MESSAGES \”.
')
Then in the file “app_controller.php” in the function “beforeFilter” we write the following:
Configure :: write ( 'Config.language' , 'ru' ) ;

Everything. Now where do we need to display the date in this format we write:
echo $time -> timeAgoInWords ( $date ) ;

Also, all these manipulations will help us display the names of the months in Russian when using:
echo $form -> input ( 'Date' , array ( 'type' => 'date' ) ) ;

Questions can be asked: xmpp: cakephp@conference.jabber.ru

Source: https://habr.com/ru/post/53275/


All Articles