reactjstypescriptweb-deployment-project

how to get the browser time in React


Is there possibility to get the browser time in react. Is there any library that can help with this. The web page should display the time of the browsers( like chrome, explorer firefox etc.)

Thank and Regards, Alexander


Solution

  • var today = new Date();
    var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
    console.log(time)