time_duration 1.0.0 copy "time_duration: ^1.0.0" to clipboard
time_duration: ^1.0.0 copied to clipboard

A simple API to find the hours and minutes between two times.

example/time_duration_example.dart

import 'package:time_duration/time_duration.dart';

void main() {
  // Create an object of TimeDuration
  final timeDuration = TimeDuration();

  // Input your times
  // Example: From 11:00 PM -> to 02:09 AM
  timeDuration.computeTime(
    fromHour: 11,
    fromMinute: 0,
    fromPeriod: TimeDurationPeriod.PM,
    toHour: 2,
    toMinute: 9,
    toPeriod: TimeDurationPeriod.AM,
  );

  // => 3 hours
  print(timeDuration.hours);

  // => 9 minutes
  print(timeDuration.minutes);

  // => total time in minutes: 189 minutes
  print(timeDuration.inMinutes);
}
1
likes
40
points
46
downloads

Publisher

verified publisherkokpheng.dev

Weekly Downloads

A simple API to find the hours and minutes between two times.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (license)

More

Packages that depend on time_duration