I have a srting date 2019-09-30, I want to convert it to 30-09-2019 in dart

Solution 1: Fatima Hossny

You can use intl.dart to formate any date . Here is a simple example of this:

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';

class Home extends StatefulWidget {
  Home({Key key}) : super(key: key);

  _HomeState createState() => _HomeState();

class _HomeState extends State<Home> {
  String dateFormate;
  Widget build(BuildContext context) {
    dateFormate = DateFormat("dd-MM-yyyy").format(DateTime.parse("2019-09-30"));
    return Container(
      child: Text(dateFormate),

Solution 2: Kab Agouda

Use intl package

This package has a great class called DateFormat that can easily do it for you .

Installing :
Add this to your pubspec.yaml file:

 intl: any

Usage : Just pass your date to DateFormat("date pattern").format(date)



Output : 30-09-2019

Another Example


Output : 2/7/2021

This package includes many other tools . You can learn more about them here.