date_util_plus

Creator: coderz1093

Last updated:

0 purchases

date_util_plus Image
date_util_plus Images

Languages

Categories

Add to Cart

Description:

date util plus

date_util_plus #


Simplify your date and time handling with DateUtilPlus for Dart – because managing time shouldn't be a hassle! 🕰️
Installation #
To use Date Utils Plus in your Dart or Flutter project, add it as a dependency in your pubspec.yaml file:
dependencies:
date_utils_plus: ^0.0.2 # Use the latest version
copied to clipboard
Run flutter pub get to fetch the package.
Import the necessary package in your Dart file:
import 'package:date_util_plus/date_util_plus.dart';
copied to clipboard
Usage #


Format Dates Like never Before
The formatServerDateTo function can format the date string from server to desired ui format from designer without any hassle.
String date = "1998-04-29".formatServerDateTo(uiFormat: "29 Dec 1999");

print(date); // 29 Apr 1998

copied to clipboard


Detect Date format from String
String? dateFormat = "September 23, 2023".detectDateFormat();
print(dateFormat); // MMMM dd, yyyy

copied to clipboard


Calculate Age
DateTime birthDate = DateTime(1990, 5, 15);
int age = birthDate.calculateAge;
print('Age: $age years'); // Age: 33 years
copied to clipboard


Format DateTime as Short Date (MM/DD/YYYY)
DateTime myDateTime = DateTime(2023, 9, 23, 14, 30);
String shortDate = myDateTime.toShortDate();
print('Short Date: $shortDate'); // Short Date: 09/23/2023
copied to clipboard


Format DateTime as Long Date (Month DD, YYYY)
DateTime myDateTime = DateTime(2023, 9, 23, 14, 30);
String longDate = myDateTime.toLongDate();
print('Long Date: $longDate'); // Long Date: September 23, 2023
copied to clipboard


Format DateTime as 24-Hour Time (HH:MM:SS)
DateTime myDateTime = DateTime(2023, 9, 23, 14, 30);
String time24Hour = myDateTime.to24HourTime();
print('24-Hour Time: $time24Hour'); // 24-Hour Time: 14:30:00 // Long Date: September 23, 2023
copied to clipboard


Format DateTime as 12-Hour Time with AM/PM (hh:MM:SS AM/PM)
DateTime myDateTime = DateTime(2023, 9, 23, 14, 30);
String time12Hour = myDateTime.to12HourTime();
print('12-Hour Time: $time12Hour'); // 12-Hour Time: 02:30:00 PM
copied to clipboard


Feature requests and Bug reports #
If you have any suggestions, issues, or contributions in mind, feel free to fork the repository and create a pull request. Your feedback is highly appreciated here.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.