toString()
MethodYou can simply use the toString()
method to convert UTC or GMT date time to local date time in JavaScript. Greenwich Mean Time (GMT) is a time zone and Coordinated Universal Time (UTC) is a time standard. Although GMT and UTC share the same current time in practice.
Let's try out the following example to understand how this method actually works:
<script>
// Create date object from datetime string
var date = new Date('Tue, 21 Apr 2020 09:20:30 GMT');
// Coverting to local datetime
console.log(date.toString());
// Coverting local datetime back to UTC
console.log(date.toUTCString()); // Tue, 21 Apr 2020 09:20:30 GMT
</script>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
Laravel5.4 - login with facebook in laravel
Hello today we are share with you one ne...How to reverse the order of an array in PHP
Use the PHP array_reverse() fu...How to get element by class name in JavaScript
Use the getElementsByClassName() method...How to Secure File in Laravel Only Allow to Access Authenticated User
In this article, i will share with you h...How to make Custome Log System in Laravel?
In this article, I will share with you h...