📅 DateTimeFormatExtension
DateTimeFormatExtension
is a lightweight Dart extension that allows formatting DateTime
objects into human-readable strings with customizable separators.
✨ Features
- Format
DateTime
into:dd/MM/yyyy
usingwithSlash
dd.MM.yyyy
usingwithDot
dd:MM:yyyy
(default) orwithDoubleDot
- Clean and simple API
- No third-party dependencies
🛠Installation
Add the file date_time_format_extension.dart
to your project or include this extension in your custom utility package.
🚀 Usage
import 'your_package_name/date_time_format_extension.dart';
void main() {
final now = DateTime(2025, 4, 25);
print(now.formatToString());
// Output: 25:04:2025
print(now.formatToString(type: DateTimeFormatterType.withSlash));
// Output: 25/04/2025
print(now.formatToString(type: DateTimeFormatterType.withDot));
// Output: 25.04.2025
}