Search code examples
dateflutterdarttimeflutter-intl

Flutter: intl, time


I'm trying to convert the date time using the intl package, but the hour that it gives me back is always 8, while here is 10 (I live in Germany). Here's the code:

  String test(){
    var now = new DateTime.now();
    var formatter = new DateFormat('yyyy-MM-dd_hh');
    String formatted = formatter.format(now);
    return formatted; // something like 2013-04-20
  }

and I've also tried something like:

var de = new Intl('de_DE');
var format = de.date().add_d().add_H();

but the hour is always 8


Solution

  • ¿Have you tried to change the time zone in the System settings of the phone or emulator where you are executing the app?

    The time is taken from the phone itself.