0 purchases
format date
A simple package that helps in formatting date and time from a given DateTime object.
Features #
Convert Datetime to String with desired format effortlessly.
Getting started #
flutter pub add format_date
copied to clipboard
Usage #
import 'package:format_date/format_date.dart';
void main(){
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
DateTime currentDateTime = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Text(
FormatDate.formatDate(dateTime: currentDateTime,), //dd-mm-yyyy
);
Text(
FormatDate.formatDate(dateTime: currentDateTime, format: 'dd/mm'),
);
Text(
FormatDate.formatTime(dateTime: currentDateTime,), //hh:mm:ss
);
Text(
FormatDate.formatTime(dateTime: currentDateTime, format: 'hh:mm'),
);
]
),
);
}
}
copied to clipboard
Additional information #
For more information:
https://github.com/gru786/format_date
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.