Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: date picker get value in dd/mm/yyyy format in mdb react

viswanathm free asked 5 years ago


hi,

i want date in dd/mm/yyyy format in react application. currently i am getting get value as Mon Jul 15 2019 18:13:00 GMT+0530 (India Standard Time)

how to use $('.datepicker').pickadate({ format: 'yyyy/mm/dd', formatSubmit: 'yyyy/mm/dd' }) in mdbreact or there is any other way.


Aliaksandr Andrasiuk staff answered 5 years ago


Hi,

Datepicker receives format property, where you can set any format you want. For example:

import React from 'react';
import { MDBDatePicker } from 'mdbreact';

class DatePickerPage extends React.Component  {
  getPickerValue = (value) => {
    console.log(value);
  }

  render() {
    return(
      <div>
        <MDBDatePicker format="YYYY / MM / DD" getValue={this.getPickerValue} />
      </div>
    );
  }
};

export default DatePickerPage;

Notice that register, a count of letters and spaces affects the date you will get:

format="M / D/YY" will set data as `7 / 12/19`
format="D MMMM, Y" will set data as `12 July, 2019`

Hope I could help you.

Best regards.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB React
  • MDB Version: 4.18.0
  • Device: laptop
  • Browser: chrome
  • OS: windows
  • Provided sample code: No
  • Provided link: No