[클라이언트]/[Flutter]
Flutter Date 다루기 / DateTime
Hevton
2022. 12. 2. 20:54
반응형
pubspec.yaml 파일에 라이브러리를 하나 추가해야 한다.
intl | Dart Package
Contains code to deal with internationalized/localized messages, date and number formatting and parsing, bi-directional text, and other internationalization issues.
pub.dev
dependencies:
flutter:
sdk: flutter
intl: ^0.17.0 // 추가
사용
var now = new DateTime.now();
String formatDate = DateFormat('yy/MM/dd - HH:mm:ss').format(now);
매우 간단!! 라이브러리 추가해야하는 수고스러움 빼고..
반응형