How to get Current time and date in ReactJs

Hi Guys,

In this tute, we will discuss how to get current date time in reactjs. you'll learn how to get current date and time in react js. you can optically discern current date and time in react js.

I expounded simply step by step get current date in react js. Let's get commenced with reactjs get current datetime.Type a message

Example : Get current Time

import React from 'react';
import logo from './logo.svg';
import './App.css';

class App extends React.Component {
  state={
    curTime : new Date().toLocaleString(),
  }
  render(){
    return (
      <div className="App">
        <p>Current Time : {this.state.curTime}</p>
      </div>
    );
  }
}

export default App;

Output :

Current Time : 21/02/2020, 15:35:35

i hope you like this article.

Tags:

Was this article helpful?

0 out of 0 person found this article helpful.

Leave a comment

Or

No Comment