“Format tanggal berkibar” Kode Jawaban

DateTime Dart Format Print

//You can use the intl package https://pub.dev/packages/intl/install

import 'package:intl/intl.dart';

main() {
  final DateTime now = DateTime.now();
  final DateFormat formatter = DateFormat('yyyy-MM-dd');
  final String formatted = formatter.format(now);
  print(formatted); // something like 2013-04-20
}
Glamorous Gibbon

format datetime flutter

import 'package:intl/intl.dart';

DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd – kk:mm').format(now);
S.Mahdi

DateFormat Lokal FR Flutter

import 'package:intl/intl.dart';
import 'package:intl/date_symbol_data_local.dart';
Awful Antelope

Format tanggal berkibar

Format Pattern                    Result
--------------                    -------
'EEE, MMM d, ''yy'                Wed, Jul 10, '96
'h:mm a'                          12:08 PM
'yyyyy.MMMMM.dd GGG hh:mm aaa'    01996.July.10 AD 12:08 PM
Clean Chicken

Format tanggal berkibar

//add, intl Flutter package

DateTime datetime = DateTime.now();
print(datetime.toString());
//output: 2021-10-17 20:04:17.118089

String datetime1 = DateFormat("yyyy-MM-dd").format(datetime);
print(datetime1);
//output: 2021-10-17

String datetime2 = DateFormat.Hms().format(datetime);
print(datetime2);
//output (Time): 20:04:17

String datetime3 = DateFormat.MMMMEEEEd().format(datetime);
print(datetime3);
//output: Sunday, October 17
Defeated Deer

Jawaban yang mirip dengan “Format tanggal berkibar”

Pertanyaan yang mirip dengan “Format tanggal berkibar”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya