I am trying to display the current DateTime in a Text widget after tapping on a button. The following works, but I\'d like to change the format.
DateTime
Text
You can use DateFormat from intl package.
DateFormat
import 'package:intl/intl.dart'; DateTime now = DateTime.now(); String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);