format_date 0.0.5 copy "format_date: ^0.0.5" to clipboard
format_date: ^0.0.5 copied to clipboard

To be able to format dates, all you need is to provide a datetime object and a desired formatting as String, as input to one of the two functions - formatDate or formatTime.

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

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'),
                );
            ]
        ),
    );
  }
}




Additional information #

For more information: https://github.com/gru786/format_date

9
likes
160
points
54
downloads

Publisher

verified publishertechtrendsindia.com

Weekly Downloads

To be able to format dates, all you need is to provide a datetime object and a desired formatting as String, as input to one of the two functions - formatDate or formatTime.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on format_date