Search results

Date Format in React DatePicker component

22 Oct 2021 / 1 minute to read

Date format is a way of representing the date value in different string format in the textbox.

By default, the DatePicker’s format is based on the culture. You can also set the own custom format by using the format property.

Once the date format property has been defined it will be common to all the cultures.

To know more about the date format standards, refer to the Internationalization Date Format section.

The following example demonstrates the DatePicker with the custom format (yyyy-MM-dd).

Copied to clipboard
// import the datepickercomponent
import { DatePickerComponent } from '@syncfusion/ej2-react-calendars';
import * as React from 'react';
import * as ReactDOM from 'react-dom';

export default class App extends React.Component<{}, {}> {

    private dateValue:Date=new Date();

    public render() {
        return <DatePickerComponent id="datepicker"  value={this.dateValue} format='yyyy-MM-dd' placeholder='Enter date' />

ReactDOM.render(<App />, document.getElementById('element'));