1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] How to get difference between 2 TimeOfDay in flutter? [closed]

Discussão em 'Mobile' iniciado por Stack, Setembro 28, 2024 às 16:12.

  1. Stack

    Stack Membro Participativo

    I want to get the duration of difference between 2 times current time and future time in 24 format and I want to store the duration in Duration class. i.e. currentTime = 13:30:20, futureTime = 16:30:10. Now I want to get its diffenrence duration = 03:00:10 and running the timer up to 16:30:10.

    for more clearity ...

    setDurationForTimes(DateTime time) {
    String x = DateFormat('hh:mm').format(time);
    TimeOfDay _startTime = TimeOfDay(
    hour: int.parse(x.split(":")[0]), minute: int.parse(x.split(":")[1]));
    var y = TimeOfDay(hour: _startTime.hour, minute: _startTime.minute);
    prayerTimeDuration = Duration(
    hours: _startTime.hour,
    minutes: _startTime.minute,
    );
    return y;
    }

    Continue reading...

Compartilhe esta Página