device_time_format

A Flutter plugin to get the device's current time and detect whether the system is set to 12-hour or 24-hour time format.

Platform Support

Android iOS
Yes No

Features

  • Get the current device time as a formatted string (respects system 12hr/24hr setting)
  • Check whether the device is using 12-hour or 24-hour format

Usage

import 'package:device_time_format/device_time_format.dart';

final deviceTimeFormat = DeviceTimeFormat();

// Get formatted current time String? time = await deviceTimeFormat.getDeviceTime(); print(time); // e.g. "06:06:25 am" or "18:06:25"

// Check format type bool? is24Hour = await deviceTimeFormat.is24HourFormat(); print(is24Hour); // true or false

Example

See the example/ folder for a complete working app.