is there any way to make the month of datetime in flutter showing by name of month not showing the number?

i have searching it before, but there is nothing like what i search.

example : if i'm using dd-MM-yyyy then it showing => 29-12-2019

is there any way to change it to : 29-dec-2019?


Solution 1: shb

Add an extra M to the pattern dd-MMM-yyyy.

you can also change the pattern like this d-MMM-y

Use DateFormat from package:intl/intl.dart

import 'package:intl/intl.dart';
//...
var now = new DateTime.now();
final df = new DateFormat('dd-MMM-yyyy');

print(df.format(now));


Solution 2: Guru Prasad mohapatra

If you want to change the String '29-12-2019' to '29-dec-2019' then You can first convert the string to DateTime format then make it to the proper format you want.

DateTime date=DateFormat("dd-MM-yyyy", "en_US").parse("29-12-2019"));
final df = new DateFormat('dd-MMM-yyyy');
print(df.format(date));