Site Admin
Site Admin Founder of MeaningArticles
1056 Views

ReactJs Get Current Date and Time

Hello Dev.

In this Article, we can discuss a way to get present day date time in reactjs. you may learn how to get current date and time in react js. you can see current date and time in react js.

I explained surely one by one get current date in react js. let's get began with reactjs get current datetime.type a message


Example

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 : 20/04/2020, 17:37:37

i'm hoping it assist you to, thanks for visit my article if you like my article then proportion together with your friend and social platform.