date_time_format
2.0.1, released 6 years ago by jamesalex.dev
Format Dart DateTime objects using standard date/time notations or relative time offsets.
What it does
Provides utility methods and DateTime extensions for formatting dates using standard notations or as relative time offsets (e.g., '5 minutes ago'). Includes various pre-defined formatting constants and supports custom abbreviations, precision levels, and rounding.
AI-written summary of version 2.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to format DateTime objects using standard date/time notations
- You need human-readable relative time offsets like '5 minutes ago' or 'In 3 days
Skip it when
- You require robust, locale-aware internationalization for a wide range of human languages beyond English-style formatting
- You only need native Dart DateTime capabilities without external formatting strings
Strengths
- Provides both utility classes and extension methods on DateTime
- Rich set of formatting constants including American and European formats
- Highly customizable relative time formatting with precision, rounding, and abbreviations
Weaknesses
- Limited localization documentation for languages outside English relative formats
- No built-in date parsing mentioned, focuses purely on formatting
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
import 'package:date_time_format/date_time_format.dart';
final dateTime = DateTime.now();
print(dateTime.format(DateTimeFormats.american));
print(dateTime.relative());Alternatives
Packages that do the same job and could replace date_time_format.
- timezone
Time zone databases and time zone aware DateTime class in Dart.
94Compare - gtk
GTK utilities for Flutter Linux applications, providing settings and application lifecycle helpers.
76Compare - flutter_flavorizr
A utility to easily create and configure application flavors in Flutter.
86Compare - sugar
Standard library extension for date-times, timezones, collections, and monads.
68Compare
Works with
Packages commonly used together with date_time_format: ones it builds on, ones built on it, and its own family.