override a function in global

Is there any solution to override date() function?

I’m trying to modify date() function for call another function every time date() executed in project.

It’s not overriding date, but are you familiar with formatters?

http://www.yiiframework.com/doc-2.0/guide-output-formatting.html#date-and-time

Actually I want to convert Gregorian date to other national calendars like Jalali.I’m looking for an easy solution to convert all dates in the project.

Thanks for attention.