date_and_time_formatter 0.1.0
date_and_time_formatter: ^0.1.0 copied to clipboard
A package for formatting dates and time with various formats.
date_time_formatter is a Flutter package that provides easy and flexible formatting for DateTime objects in various formats using the intl package. Installation Add this to your package's pubspec.yaml file:
yaml dependencies: date_time_formatter: latest_version
Then, run:
bash flutter pub get
Usage #
Import the package in your Dart code:
dart import 'package:date_time_formatter/date_time_formatter.dart'; void main() { DateTime now = DateTime.now(); print(now.toAppDateTime(DateFormatEnum.appDate)); // Example output: Aug 12, 2024 }
Examples #
dart DateTime now = DateTime.now(); // Different formatting options print(now.toAppDateTime(DateFormatEnum.dateMonthYear)); // Output: "12 Aug, 2024" print(now.toAppDateTime(DateFormatEnum.dateMonth)); // Output: "12 Aug" print(now.toAppDateTime(DateFormatEnum.dateOnly)); // Output: "12"
License This project is licensed under the MIT License - see the LICENSE file for details. Contributing Contributions are welcome! Please feel free to submit a Pull Request.