By using this :
Text(new DateTime.fromMillisecondsSinceEpoch(values[index][\"start_time\"]*1000).toString(),
I am getting the ty
You can use date_format
plugin available here https://pub.dartlang.org/packages/date_format
Then to convert,
formatDate(DateTime.now(), [dd, '/', mm, '/', yyyy, ' ', HH, ':', nn])
var dateInFormatText = widget.snapshot["date"].toString().split("/");
DateTime dateResult = new DateTime.utc(
int.parse(dateInFormatText[2]),
int.parse(dateInFormatText[1]),
int.parse(dateInFormatText[0]));
If you use the intl package
final f = new DateFormat('yyyy-MM-dd hh:mm');
Text(f.format(new DateTime.fromMillisecondsSinceEpoch(values[index]["start_time"]*1000)));
If you use the intl package:
var date = DateTime.fromMicrosecondsSinceEpoch(miliseconds * 1000)
DateFormat(DateFormat.YEAR_MONTH_DAY, 'pt_Br').format(date.toUtc())
Output: 10 de abril de 2020
First install the pub.dev/packages/intl package in your pubspec.yaml
intl: ^0.16.1
Then use
final df = new DateFormat('dd-MM-yyyy hh:mm a');
int myvalue = 1558432747;
print(df.format(new DateTime.fromMillisecondsSinceEpoch(myvalue*1000)));
Output
21-05-2019 10:59 AM
Use intl package:
import 'package:intl/intl.dart';
And then:
var inputFormat = DateFormat('dd/MM/yyyy HH:mm');
var inputDate = inputFormat.parse('31/12/2000 23:59'); // <-- Incoming date
var outputFormat = DateFormat('MM/dd/yyyy hh:mm a');
var outputDate = outputFormat.format(inputDate); // <-- Desired date
print(outputDate); // 12/31/2000 11:59 PM