then can anyone suggest something else
a new JS code or in php
It isn't possible from a client's perspective. What happens when you paste this into your address bar is your browser is making an alert with the date and time that the header said the page was last edited on. With PHP, the underlying HTTP server will instead send the current date and time because the page is dynamically being created.
If you go to a static page which is hosted on a web server that sends the last modified date & time in the header, then you will get the correct time it was last modified.