Change the date format
Pajaura opened this issue · comments
Hello. I would like to change the format of the dates displayed (for example, those of loans) from the current YYYY-MM-DD to DD-MM-YYYY. I tried to change some parameters in the code but I was not successful. How can I do? TY
You want to change it when you edit a movie/tv-series?
Or just when you display the information.
You can change the display template as follows. Everything else requires changes to the PHP-base or database; and is therefore not recommended.
https://github.com/jreklund/php4dvd/blob/master/tpl/default/movies/movie.html#L234
{$smarty.const.LOANED_OUT|htmlentities:3:'UTF-8'}{if $movie->loanname != ""} {$smarty.const.TO|htmlentities:3:'UTF-8'} {$movie->loanname|htmlentities:3:'UTF-8'}{/if}{if $movie->loandate != "0000-00-00"} {$smarty.const.ON|htmlentities:3:'UTF-8'} {$movie->loandate|date_format:"%d-%m-%Y"|htmlentities:3:'UTF-8'}{/if}
I need to change date format for the entire system, in edit mode and in visualization too. I have already try to change the code as you have suggest but nothing happend..
The above code are only for the visual template. You may need to delete everything inside the folder compiled.
If you really need it changed you need to do the following:
Create a custom jquery validation for your format for tpl\default\movies\javascript\update.html and tpl\default\movies\update.html
Convert from your date format into ISO-date format YYYY-MM-DD before saving it in the database: in includes\movie.update.inc.php before line 93
Convert from ISO-date format YYYY-MM-DD into your format: in templates tpl\default\movie.html and update.html (same folder) OR convert it after it have been fetched in includes\movie.inc.php on line 45.