s.j
s.j

Reputation: 651

date time format value -

In flutter getting value but how to convert this in date format

print("day:" + day.toString());
print("month" + month.toString());
print("year" +year.toString());

getting this value:

day:7
I/flutter (12167): month10
I/flutter (12167): year1993

year value format as this - "1993-10-07". Now, how to convert the value into date-time format and show in this type of date format

Upvotes: 0

Views: 80

Answers (1)

Abhijith
Abhijith

Reputation: 2327

String formatteddate="${year.toString()}-${month.toString().padLeft(2,'0')}-${day.toString().padLeft(2,'0')}"

Upvotes: 1

Related Questions