If you know MySQL, you will certainly know the NOW() function that outputs the current date and time with the timezone of the MySQL server. For easy use and compatibility, we use UTC time zone for storing time in database. If you are running a web app that comply with MySQL, then you need the date function as same as the NOW().
So, I will give you a small function that return the same value as MySQL’s NOW() function in both UTC and local time. There are 2 versions of this function, one little big and the other very short (1 line of code). The shorter one is supported by modern browsers and the other is supported by all browsers.
... [READ MORE]