A new Flutter package for getting time formats in seconds, minutes, hours, days and date.

pub package Build Status

Usage

import 'package:get_time_ago/get_time_ago.dart';
var dateTime = DateTime.now();

var result = TimeAgo.getTimeAgo(dateTime);
print(result);

If you have saved DateTime as string in database, then you can parse it as:

import 'package:get_time_ago/get_time_ago.dart';
var dateTime = timestamp; // String DateTime from backend.

var result = TimeAgo.getTimeAgo(DateTime.parse(timestamp));
print(result);

Libraries

get_time_ago