Dart DatTime

DateTimeオブジェクトを文字列へ変換

1
2
3
4
import 'package:intl/intl.dart';
DateFormat dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss');

String str = dateFormat.format(DateTime.now());

文字列をDateTimeオブジェクトへ変換

1
2
3
4
import 'package:intl/intl.dart';
DateFormat dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss');

DateTime dateTime = dateFormat.parse('2020-02-02 20:20:20');

コメント

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×