I tried to build an application which should give out the local time from Vienna. I formatted the time with time = DateFormat.jm().format(), but now I get a time like 14:25 PM. How can I delete the PM, because I don´t need it?
This is the code I tried:
class _MyHomePageState extends State<MyHomePage> {
void getTime() async {
String time;
Response response =
await get("http://worldtimeapi.org/api/timezone/Europe/Vienna");
Map data = jsonDecode(response.body);
String datetime = data["datetime"];
String offset = data["utc_offset"].substring(1, 3);
DateTime now = DateTime.parse(datetime);
now = now.add(Duration(hours: int.parse(offset)));
time = DateFormat.jm().format(now);
print(time);
}
And this is the time I get:
I/flutter ( 9302): 12:43 PM